You can translate the content of this page by selecting a language in the select box.
What are the top 10 algorithms every software engineer should know by heart?
As a software engineer, you’re expected to know a lot about algorithms. After all, they are the bread and butter of your trade. But with so many different algorithms out there, how can you possibly keep track of them all?
Never fear! We’ve compiled a list of the top 10 algorithms every software engineer should know by heart. From sorting and searching to graph theory and dynamic programming, these are the algorithms that will make you a master of your craft. So without further ado, let’s get started!
Sorting Algorithms
Sorting algorithms are some of the most fundamental and wellstudied algorithms in computer science. They are used to order a list of elements in ascending or descending order. Some of the most popular sorting algorithms include quicksort, heapsort, and mergesort. However, there are many more out there for you to explore.
Searching Algorithms
Searching algorithms are used to find an element in a list of elements. The most famous search algorithm is probably binary search, which is used to find an element in a sorted list. However, there are many other search algorithms out there, such as linear search and interpolation search.
Graph Theory Algorithms
Graph theory is the study of graphs and their properties. Graph theory algorithms are used to solve problems on graphs, such as finding the shortest path between two nodes or finding the lowest cost path between two nodes. Some of the most famous graph theory algorithms include Dijkstra’s algorithm and BellmanFord algorithm.
This graph has six nodes (AF) and eight arcs. It can be represented by the following Python data structure:
graph = {'A': ['B', 'C'], 'B': ['C', 'D'], 'C': ['D'], 'D': ['C'], 'E': ['F'], 'F': ['C']} def find_all_paths(graph, start, end, path=[]): path = path + [start] if start == end: return [path] if not graph.has_key(start): return [] paths = [] for node in graph[start]: if node not in path: newpaths = find_all_paths(graph, node, end, path) for newpath in newpaths: paths.append(newpath) return paths A sample run: >>> find_all_paths(graph, 'A', 'D') [['A', 'B', 'C', 'D'], ['A', 'B', 'D'], ['A', 'C', 'D']] >>>
# Code by Eryk Kopczyński def find_shortest_path(graph, start, end): dist = {start: [start]} q = deque(start) while len(q): at = q.popleft() for next in graph[at]: if next not in dist: dist[next] = [dist[at], next] q.append(next) return dist.get(end)
Dynamic Programming Algorithms
Dynamic programming is a technique for solving problems that can be divided into subproblems. Dynamic programming algorithms are used to find the optimal solution to a problem by breaking it down into smaller subproblems and solving each one optimally. Some of the most famous dynamic programming algorithms include FloydWarshall algorithm and Knapsack problem algorithm.
Number Theory Algorithms
Number theory is the study of integers and their properties. Number theory algorithms are used to solve problems on integers, such as factorization or primality testing. Some of the most famous number theory algorithms include Pollard’s rho algorithm and MillerRabin primality test algorithm.
Example: A school method based Python3 program to check if a number is prime
def isPrime(n):
# Corner case
if n <= 1:
return False
# Check from 2 to n1
for i in range(2, n):
if n % i == 0:
return False
return True
Driver Program to test above function
print(“true”) if isPrime(11) else print(“false”)
print(“true”) if isPrime(14) else print(“false”)
This code is contributed by Smitha Dinesh Semwal
Combinatorics Algorithms
Combinatorics is the study of combinatorial objects, such as permutations, combinations, and partitions. Combinatorics algorithms are used to solve problems on combinatorial objects, such as enumeration or generation problems. Some of the most famous combinatorics algorithms include Gray code algorithm and Lehmer code algorithm.
Example: A Python program to print all permutations using library function
from itertools import permutations
Get all permutations of [1, 2, 3]
perm = permutations([1, 2, 3])
Print the obtained permutations
for i in list(perm):
print (i)
Output:
If you are looking for an allinone solution to help you prepare for the AWS Cloud Practitioner Certification Exam, look no further than this AWS Cloud Practitioner CCP CLFC01 book below.
(1, 2, 3) (1, 3, 2) (2, 1, 3) (2, 3, 1) (3, 1, 2) (3, 2, 1)
It generates n! permutations if the length of the input sequence is n.
If want to get permutations of length L then implement it in this way.
Geometry Algorithms
Geometry is the study of shapes and their properties. Geometry algorithms are used to solve problems on shapes, such as finding the area or volume of a shape or finding the intersection point of two lines. Some of the most famous geometry algorithms include Heron’s formula and Bresenham’s line drawing algorithm.
Cryptography Algorithms
Cryptography is the study of encryption and decryption techniques. Cryptography algorithms are used to encrypt or decrypt data. Some of the most famous cryptography algorithms include RSA algorithm and Diffie – Hellman key exchange algorithm.
String Matching Algorithm
String matching algorithms are used t o find incidences of one string within another string or text . Some of the most famous string matching algorithms include KnuthMorrisPratt algorithm and BoyerMoore string search algorithm.
Data Compression Algorithms
Data compression algorithms are used t o reduce the size of data files without losing any information . Some of the most famous data compression algorithms include LempelZivWelch (LZW) algorithm and run – length encoding (RLE) algorithm. These are just some of the many important algorithms every software engineer should know by heart ! Whether you’r e just starting out in your career or you’re looking to sharpen your skill set , learning these algorithms will certainly help you on your way!
According to Konstantinos Ameranis, here are also some of the top 10 algorithms every software engineer should know by heart:
I wouldn’t say so much specific algorithms, as groups of algorithms.
Greedy algorithms.
If your problem can be solved with an algorithm that can make a decision now and at the end this decision will still be optimal, then you don’t need to look any further. Examples are Prim, Kruscal for Minimal Spanning Trees (MST) and the Fractional Knapsack problem.
Divide and Conquer.
Examples of this group are binary search and quicksort. Basically, you divide your problem into two distinct subproblems, solve each one separately and at the end combine the solutions. Concerning complexity, you will probably get something recursive e.g. T(n) = 2T(n/2) + n, which you can solve using the Master theorem
Graph and search algorithms.
Other than the MST, Breadth First Search (BFS) and Depth First Search (DFS), Dijkstra and possibly A*. If you feel you want to go further in this, BellmanFord (for dense graphs), Branch and Bound, Iterative Deepening, Minimax, AB search.
Flows. Basically, FordFulkerson.
Simulated Annealing.
This is a very easy, very powerful randomized optimization algorithm. It gobbles NPhard problems like Travelling Salesman Problem (TSP) for breakfast.
Hashing. Properties of hashing, known hashing algorithms and how to use them to make a hashtable.
Dynamic Programming.
Examples are the Discrete Knapsack Problem and Longest Common Subsequence (LCS).
Randomized Algorithms.
Two great examples are given by Karger for the MST and Minimum Cut.
Approximation Algorithms.
There is a trade off sometimes between solution quality and time. Approximation algorithms can help with getting a not so good solution to a very hard problem at a good time.
Linear Programming.
Especially the simplex algorithm but also duality, rounding for integer programming etc.
These algorithms are the bread and butter of your trade and will serve you well in your career. Below, we will countdown another top 10 algorithms every software engineer should know by heart.
Binary Search Tree Insertion
Binary search trees are data structures that allow for fast data insertion, deletion, and retrieval. They are called binary trees because each node can have up to two children. Binary search trees are efficient because they are sorted; this means that when you search for an element in a binary search tree, you can eliminate half of the tree from your search space with each comparison.
Quicksort
Quicksort is an efficient sorting algorithm that works by partitioning the array into two halves, then sorting each half recursively. Quicksort is a divide and conquer algorithm, which means it breaks down a problem into smaller subproblems, then solves each subproblem recursively. Quicksort is typically faster than other sorting algorithms, such as heapsort or mergesort.
Dijkstra’s Algorithm
Dijkstra’s algorithm is used to find the shortest path between two nodes in a graph. It is a greedy algorithm, meaning that it makes the locally optimal choice at each step in order to find the global optimum. Dijkstra’s algorithm is used in routing protocols and network design; it is also used in manufacturing to find the shortest path between machines on a factory floor.
Linear Regression
Linear regression is a statistical method used to predict future values based on past values. It is used in many fields, such as finance and economics, to forecast future trends. Linear regression is a simple yet powerful tool that can be used to make predictions about the future.
Kmeans Clustering
Kmeans clustering is a statistical technique used to group similar data points together. It is used in many fields, such as marketing and medicine, to group customers or patients with similar characteristics. Kmeans clustering is a simple yet powerful tool that can be used to group data points together for analysis.
Support Vector Machines
Support vector machines are supervised learning models used for classification and regression tasks. They are powerful machine learning models that can be used for data classification and prediction tasks. Support vector machines are widely used in many fields, such as computer vision and natural language processing.
Gradient Descent
Gradient descent is an optimization algorithm used to find the minimum of a function. It is a firstorder optimization algorithm, meaning that it uses only first derivatives to find the minimum of a function. Gradient descent is widely used in many fields, such as machine learning and engineering design.
PageRank
PageRank is an algorithm used by Google Search to rank websites in their search engine results pages (SERP). It was developed by Google cofounder Larry Page and was named after him. PageRank is a link analysis algorithm that assigns a numerical weighting to each element of a hyperlinked set of documents, such as the World Wide Web (WWW), with the purpose of “measuring” its relative importance within the set.(Wikipedia)
RSA Encryption
RSA encryption is a publickey encryption algorithm that uses asymmetric key cryptography.(Wikipedia) It was developed by Ron Rivest, Adi Shamir, and Len Adleman in 1977 and has since been widely used in many different applications.(Wikipedia) RSA encryption is used to secure communications between parties and is often used in conjunction with digital signatures.(Wikipedia)
Fourier Transform
The Fourier transform is an integral transform that decomposes a function into its constituent frequencies.(Wikipedia) It was developed by Joseph Fourier in 1807 and has since been widely used in many different applications.(Wikipedia) The Fourier transform has many applications in physics and engineering, such as signal processing and image compression.(Wikipedia)
Conclusion:
These are the top 10 algorithms every software engineer should know by heart! Learning these algorithms will help you become a better software engineer and will give you a solid foundation on which to build your career!
Algorithm Breaking News 2022 – 2023
Instagram algorithm 2022 – 2023
Because the inception of 2010, Instagram has proved its price. The platform that was earlier generally known as a photosharing hub has step by step developed itself into aneCommerce platform with Instagram Procuring. Right now most companies use Instagram as a marketing tool to extend their attain throughout the platform. Within the earlier days of Instagram, hashtags grew to become a pattern for straightforward grouping and looking. In a while, a function of product tagging was launched. It made it simpler for folks to seek for the merchandise. In 2016, Instagram algorithms made a serious change. It launched Instagram tales, reside movies, and new enterprise instruments to show their merchandise and gain more followers to their profile.
Read More; How Instagram Algorithm Works In 2022: A Social Media Marketer’s Guide
Instagram uses “Read Path Models” to rank content. It’s an algorithm used by Developers to find the best outcome in a project or a basic filtering algorithm.
Here’s How the algorithm works to rank your content on explore page and home!
First your content is published after Instagram algorithm confirms its Community Guidelines.
After that, Algorithm classifies your content based on your Post Design and Captions.
Using Photorecognition Instagram Scans your content finds similarities between your new piece of content and your audience’s previous interactions with your old content.
The same process occurs with your post captions. Your post instantly starts reaching your most followers and as engagement rises it gets on explore page.
In words of Instagram employee, This “Write Path Classifiers” algorithm didn’t tracked most important metrics to keep the explore page. That’s why they started building a new version of the algorithm that you can read below!
The new algorithm uses 3 Crucial ways to source content for Your Instagram Explore feed!
Instagram algorithm calculates realtime engagement and upload time signals to consider your post for Explore page.
In simple words, Instagram measures how much engagement creators at your level get and how much engagement your recent posts and how’s the engagement growing since the upload time.
Tip: Look at your insights and see what time your followers are highly active and post 4070 minutes before the peak time.
This step constitutes search queries from Instagram users related to your post.
Instagram finds targeted users to show your post to them based on their search queries. Your post will show up on top of their explore page.
A Post on “Start Your Entrepreneurship Journey” will be shown to people searching for entrepreneurship to a small query about passive income.
From those queries Instagram source content for explore page.
How long you rank on Instagram page and to what audience depends on the engagement you get when you start ranking on explore page.
After the sourcing step is passed that means your content is eligible to rank on explore page.
And during this step, tracking engagement metrics and their growth algorithm keeps your Post on Explore Page.
Instagram announced Sensitivity control last year which impacted Instagram explore algorithm again!
What’s changed?
Instagram launched two new filters one High precision and low precision filters to maintain better content on Instagram for Different audiences.
Explore page changes every second with every refresh. So, do your content’s target audience.
With these two filters, Instagram tries to track engagement from differentdifferent users and changes pieces of content.
In simple words, Instagram doesn’t want to show people bad content. That’s why these filters work to run explore page content through database to find if it’s suitable to run for another minute, hour or day on Instagram.
You get Hashtags reach because Instagram’s old algorithm “Write Path Classifier” is applicable to every single format of content.
Means your content ranks on hashtags based on relevancy with your Post Image and Caption.
If it’s relevant and getting enough engagement to rank on Hashtags size. You will rank on hashtags. It’s not hard to crack hashtags algorithm. The advice is don’t focus on hashtags that much, and keep your eyes on creating content for explore page.
“Instagram story views increase and decrease based on “navigation” and “interaction”.
What’s navigation?
In Instagram story insights, you will see a metric called “navigation” and below that you will see
Back means the follower swiped back to see your last story or someone else’s story they saw before! Forward means the follower clicked to see your next story Next story the follower moved to see someone else’s story Exited means the follower left the stories.
Founded: If your story have more forward and next stories. Then Instagram will push your stories to more followers as they want users to watch more stories and stay in stories tab.
Why?: After 23 stories they hit users with an ad!
Interactions: Polls/ Question stickers/ Quiz
When viewers interact with these story features. Instagram sees that followers are interacting more than before and that’s why they start pushing it more
How interactions like “profile visits” effect story views?
Yes, if your followers are visiting your profile through stories. Then that particular story (if its the first one) will receive more views than average as my story with 44 profile visits received the most views. So, you should do something worth a profile visit!
I didn’t get much out of the conversation about Instagram reels from employees at IG.
But the only tip was to maintain the highest quality of video while uploading because while content distribution through Instagram processors your video might lose some quality.
Acls algorithm 2022 – 2023,
Free copy/print of all the ACLS algorithms
Algorithms for Advanced Cardiac Life Support
algoarrestTiktok algorithm 2022 – 2023,

Your first few hours on tiktok are crucial to your growth.

You gonna spend few hours on fyp, interacting with videos and creators about your niche. After few hours, you can start to make your first video

The very first video plays a huge role in your future. Quality content Unique but similar to your niche

915 seconds maximum!!

After upload, wait about a few hours, before your second video

2nd video needs to have a hook

“You won,t believe this”

“ Nobody is talking about this, but”

“Did you know that..?”

“ X tips on how to ..”

Your hook needs to be on your first few seconds of the video

Your videos needs to be captivating or strange, this way users spends more time on it.

Your next 3 videos should be similar

Tiktok usually boosts your first videos, that’s their hook

Now you need to hook tiktok onto your account to keep boosting it.

You will lose views and engagement

Its normal, you are not shadow banned. you just have to do it on your own now.

Now its time to get more followers

Do duets/stiches/parts

this way you hook your new followers and cycle up your old videos

now you need to have schedule

34 posts /day works the best.

wait 34h before your next post

Followers >Views

If you have 10k followers then you need at least 10k views /post to keep growing fast Don’t follow people who follow you.
How Does The Tiktok Algorithm Work? (+10 Viral Hacks To Go)
Youtube algorithm 2022 – 2023,
Google algorithm update 2022 – 2023,
https://developers.google.com/search/updates/ranking
This page lists the latest ranking updates made to Google Search that are relevant to website owners. To learn more about how Google makes improvements to Search and why we share updates, check out our blog post on How Google updates Search. You can also find more updates about Google Search on our blog.
https://blog.google/products/search/howweupdatesearchimproveresults/
https://www.seroundtable.com/category/googleupdates
Twitter algorithm 2022 – 2023,
Twitter, which was founded in 2006, is still one of the world’s most popular social networking sites. As of 2020, there are over 340 million active Twitter users, with over 500 million tweets posted each day.
That’s a lot of information to sort through. And, if your company is going to utilize Twitter effectively, you must first grasp how Twitter’s timeline algorithm works and then learn the most dependable techniques of getting your information in front of your target audience.
Twitter Timeline Options: Top Tweets and Most Recent Tweets(Latest)
The Twitter Timeline may be configured to show tweets in two ways:
• Top Tweet
• Recent Tweets
These modes mays be switched by clicking the Stars icon in the upper right corner of your timeline feed.
The Most Popular Tweets
Top Tweets use an algorithm to display tweets in the order that a user is most likely to be interested in. The algorithm is based on how popular and relevant tweets are. Because of the large number of tweets sent at any given time, Twitter news feed algorithms like this one were developed to protect users from becoming overwhelmed and to keep them up to date on material that they genuinely care about.
Recent Tweets
The Latest Tweets section reorders your timeline in reverse chronological order, with the most recently Tweeted Tweets at the top. It displays tweets as they are sent in real time, so more information from more people will appear, but it will not display every tweet. The algorithm will still have some say in deciding which tweets to broadcast at the time.
Ranking Signals for the Twitter Timeline Algorithm:
The following are ranking indications for the Twitter timeline algorithm:
• How recent it is
• Use of rich media (pictures, gifs, video)
• Engagement (likes, responses, retweets)
• Author prominence
• Userauthor relationship
• User behavior
For example, a user is more likely to see a tweet in their timeline if it comes from a person with whom they frequently interact and has a large number of likes and responses.
What exactly are Twitter Topics?
Facebook Algorithm 2022 – 2023
Facebook can tend to feel like an uphill battle for businesses. The social media platform’s algorithm isn’t very clear about how your posts end up on users’ screens. When even the sponsored posts you’re investing in aren’t working, you know there has to be something you’re missing.
Paid or unpaid, the way you post on Facebook and reach the platform’s everexpanding audience matters. Every time a user logs on to the website or app, Facebook is learning about what that user likes seeing and what they skip past.
The social media giant has tried a lot of different algorithms over the years, ranging from focusing on the video to simply asking users what they want to see more of. Today, things look a little different, and knowing how the Facebook algorithm works can be a gamechanger for businesses.
So here’s what you need to know about Facebook’s Algorithm in 2021:
Facebook is concerned with three things when its algorithm learns about user activity and begins curating their feed to these behaviors.
Following these three elements to a great post can mean huge things for your engagement and reach on Facebook. Ignoring them ends up in things like these terrible Facebook ads we wish we never saw.
First up, the accounts with which the user interacts matter. If someone is always checking up on certain friends and family members, then that’s going to mean their posts will show up sooner on their feed.
The same goes for organizations and businesses that users interact with the most. That means it’s your job to post content that encourages users to not only follow and like you but also provide users the type of content that drives engagement.
What sort of posts do best on Facebook?
Users all have their own preferences for what they like to see. At the end of the day, a mix of videos, links to blogs and web pages, and photos are good to keep things diverse and dynamic.
That said, the sort of posts that do best on your business account will depend on the final element of the Facebook algorithm that matters most: user interactions.
From sharing a post to simply giving it a like or reaction, interactions matter most when it comes to the Facebook algorithm. The social media platform wants users active and logging in as often as possible. That’s why their machine learning algorithm sees interactions as a huge plus for your account.
Comments matter too! In fact, comments serve a dual purpose for your business account on Facebook. Not only do comments drive interactions on your page, but they also give you direct feedback from the audience.
If you listen to comments and take your user’s feedback seriously, you can avoid posting content that ends up falling flat. That doesn’t just hurt your reach and engagement but it’s also a blunder on your digital brand.
Can you beat the Facebook Algorithm once and for all?
We don’t like putting negative energy into the universe, but the Facebook algorithm is sort of like a villain you need to take down to achieve your goals as a business. Understanding the Facebook algorithm can feel like a battle sometimes.
How Does Amazon’s Search Algorithm Work to Find the Right Products?
The search algorithm of Amazon is sophisticated and has a key goal. It aims to connect online shoppers with the products they are looking for as soon as possible. If you reach the top of the Search Pages, your brand visibility will improve, and sales will go up.
Not an essay but here’s a summary:

Based on a VickreyClarkeGroves (VCG) auction.

Total Value = Bid*(eCTR*eCVR)+Value (info)

This creates an oCPM environment (info)
The core of this according to the auction and engineering team has more or less been the same for years.
2018/2020 are different issues. The former affecting (mostly) those who don’t understand oCPM as FB prioritizes user experience and the latter causing issues for those still relying on attribution instead of lift (info).
Audio recognition software like Shazam – how does the algorithm work?
Have a read through this mate http://codinggeek.com/howshazamworks/
It identifies the songs by creating a audio fingerprint by using a spectrogram. When a song is being played ,shazam creates an audio fingerprint of that song (provided the noise is not high) ,and then checks if it matches with the millions of other audio fingerprints in its database, if it finds a match it sends the info. Here is a really good blog : https://www.toptal.com/algorithms/shazamitmusicprocessingfingerprintingandrecognition
How does the PALS algorithm in 2022 actually work?
What are some ways we can use machine learning and artificial intelligence for algorithmic trading in the stock market?
Machine Learning Engineer Interview Questions and Answers
 Why Do I Recommend That You Learn to Type with 10 Fingers Before Learning Coding?by Fanan_Fadhil (Programming on Medium) on May 30, 2023 at 2:05 pm
Discover why learning to type with 10 fingers is crucial before diving into coding. Explore websites to enhance your typing skilContinue reading on Medium »
 TypeScript Tricks for Writing Clean Code: Exploring Best Practices with Code Examplesby FardaKarimov (Programming on Medium) on May 30, 2023 at 2:01 pm
The ability of TypeScript to introduce static typing to JavaScript and improve the quality and maintainability of code has led to a huge…Continue reading on Medium »
 Python Quiz App “QuizWiz” — Test Your Knowledge with Fun!by AlJunaed Islam (Programming on Medium) on May 30, 2023 at 2:01 pm
QuizWiz: A Python program for multiplechoice quizzes across categories and difficulty levels using a questionanswer collection.Continue reading on Medium »
 Unlocking a New Dimension of ChatGPT: TexttoSpeech Integrationby Andrea Valenzuela (Programming on Medium) on May 30, 2023 at 2:00 pm
Enhancing User Experience in ChatGPT InteractionsContinue reading on Towards Data Science »
 A Programming Lesson from “The Princess Bride”by Kevin King (Programming on Medium) on May 30, 2023 at 1:45 pm
When art imitates life.Continue reading on Medium »
 Unlocking Expertise: The Power of Technical Depth and Technical Breadth in Tech Careersby The Dumb Programmer (Programming on Medium) on May 30, 2023 at 1:37 pm
IntroductionContinue reading on Medium »
 Flutter’s support for internationalization (i18n): An essential for global app successby Yatendrakumar (Programming on Medium) on May 30, 2023 at 1:35 pm
Learn how to use Flutter’s builtin tools and libraries to create a localized experience for users in different languages and locales.Continue reading on Medium »
 New AIs that out performs ChatGPTby Sammy Ndubuisi (Programming on Medium) on May 30, 2023 at 1:34 pm
Continue reading on Medium »
 Sentry tracing decorator in Typescriptby Alexandru Cambose (Programming on Medium) on May 30, 2023 at 1:33 pm
Enhancing Debugging and Error Tracking with the Power of a Sentry Tracing Decorator in Typescript.Continue reading on JavaScript in Plain English »
 289K Medium Articles In One Placeby Nishu Jain (Programming on Medium) on May 30, 2023 at 1:32 pm
Introducing Our Massive Dataset of 289k Medium ArticlesContinue reading on DataDrivenInvestor »
 Agglomerative Hierarchical Clustering complexityby /u/CompteDeMonteChristo (Algorithm) on April 11, 2023 at 4:19 pm
I wrote an algorithm for Agglomerative Hierarchical Clustering General agglomerative clustering methods have a time complexity of O(N³) and a memory complexity of O(N²) due to the need to calculate and recalculate full pairwise distance matrices. I'd like to calculate the complexity for it. The algorithm running on random data is empirically 60 times faster on 1000 points, 200 faster with 2000 points and 500 times faster with 3000 points. It is clearly not O(N³) I'd like to calculate or estimate the complexity of it. Could someone help me on this? You can test and get the source on this page: https://preview.redd.it/2bv8hmqj6ata1.png?width=1170&format=png&auto=webp&s=c213b338ae524f38fd3e0be9e38258d04b2b2bcc https://ganaye.com/ahc/?numberOfPoints=3000&wantedClusters=6&linkage=avg&canvasSize=500 submitted by /u/CompteDeMonteChristo [link] [comments]
 Algorithm Help to Find Optimum Combination of Variables So Result Fits Within Set Boundsby /u/chagawagaloo (Algorithm) on September 14, 2020 at 2:26 pm
Hello I'm working on an algorithm to identify an ideal combination of pricing rates for 3D printed parts that will result in a sales price that fits within a range of margins. I have the option of using variables such as "Price per part volume", "Price per box volume", etc (Information which can all be extracted from a 3D file essentially) Previously, I tried to ensure we never made a loss, but this resulted in some parts being vastly overpriced. The solution I was using also fell apart quickly once we increased the quantity (Only looking to price this way between qty 110 so not an infinite number of options luckily). I've been building a script in VBA (Easiest to implement without rebuilding the entire cost analysis document in another language, but Python is my next go to) to automate the optimisation process, where it randomises the variables between a min and max bound and checks it against the results range set. If it finds a solution with qty 1, it iterates over all the quantities and checks to ensure it fits within the bounds. My current algorithm isn't coming up with any solutions across nearly a million iterations so I want to find a way to improve the efficiency of the algorithm to eliminate variable ranges that don't lead to a successful result. Essentially, design this so it can automatically rule out variable combinations that will not result in a successful result and drastically improve the run time (Currently can take 2 hours without finding a solution) I had a look at the Bisection method previously, but implementing this for around 8 variables has proven tricky (It's possible to eliminate some variables to make this easier but I'll need to use at least 34 at a minimum). My question is, how can I design this algorithm to look at previously failed solutions and the variables that led to them so that it can feed this information back and tweak the min/max ranges the variables can fall into? Also, is it possible to write an algorithm that can check if there will ever be a suitable solution? submitted by /u/chagawagaloo [link] [comments]
 Finding Clique idsby /u/239847293847 (Algorithm) on August 31, 2020 at 2:06 pm
Hello I have the following problem: I have a few million tuples of the form (id1, id2). If I have the tuple (id1, id2) and (id2, id3), then of course id1, id2 and id3 are all in the same group, despite that the tuple (id1, id3) is missing. I do want to create an algorithm where I get a list of (id, groupid) tuples as a result. How do I do that fast? I've already implemented an algorithm, but it is way too slow, and it works the following (simplified): 1) increment groupid 2) move first element of the tuplelist into the toprocessset 3) move first element of the toprocessset into the processed set with the current groupid 4) find all elements in the tuplelist that are connected to that element and move them to the toprocessset 5) if the toprocessset isn't empty go back to 3 6) if the tuplelist is not empty go back to 1 submitted by /u/239847293847 [link] [comments]
 What is the relation of input arguments with Time Complexity?by /u/noobrunner6 (Algorithm) on July 4, 2020 at 1:35 am
Big O is about finding the growth rate with the respect of input size growing, but in all of the algorithms analysis we do how is the input size affecting the growth rate considered? From my experience, we just go through the code and see how long it will take to process based on the code written logic but how does input arguments play a factor in determining the time complexity, quite possible I do not fully understand time complexity yet. One thing I still do not get is how if you search up online about big O notation it mentions how it is a measure of growth of rate requirements in consideration of input size growing, but doesn’t worst case Big O consider up to the worst possible case? I guess my confusion is also how does the “input size growing” play a role or what do they mean by that? submitted by /u/noobrunner6 [link] [comments]
 Extract position and size of letters in a bitmap C++by /u/therealcain (Algorithm) on June 14, 2020 at 6:54 am
Hello guys, I have a bitmap that representing letters, and I want to extract the position and the size of each letter in the bitmap. For example, Here is my bitmap: bool bitmap[WIDTH][HEIGHT] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; If you will look very close, it's saying HEY, I want my program to print out this: H = Start at 2, 1 and End at 5,7 E = Start at 7,1 and End at 10,7 Y = Start at 12,1 and End at 16,7 I have looked at the fill flood algorithm because it's quite similar, here is what I come up with: void extract_bits_locations(bool bitmap[][HEIGHT], int x, int y, sRange& range) { if (x < 0  x >= WIDTH) return; if (y < 0  y >= HEIGHT) return; if (bitmap[x][y] == false) return; if (range.minx >= x) range.minx = x; if (range.miny >= y) range.minx = y; if (range.maxx <= x) range.maxx = x; if (range.maxy <= y) range.maxy = y; extract_bits_locations(bitmap, x + 1, y, x, y, range); extract_bits_locations(bitmap, x  1, y, x, y, range); extract_bits_locations(bitmap, x, y + 1, x, y, range); extract_bits_locations(bitmap, x, y  1, x, y, range); extract_bits_locations(bitmap, x + 1, y + 1, x, y, range); extract_bits_locations(bitmap, x  1, y + 1, x, y, range); extract_bits_locations(bitmap, x + 1, y  1, x, y, range); extract_bits_locations(bitmap, x  1, y  1, x, y, range); } std::vector<sRange> extract_bits_bitmap(bool bitmap[][HEIGHT]) { std::vector<sRange> vec; for (size_t x = 0; x < WIDTH; x++) { for (size_t y = 0; y < HEIGHT; y++) { sRange range; extract_bits_locations(bitmap, x, y, range); auto contains = [&vec](const sRange& e) > bool { for (const auto& v : vec) { if (v.minx == e.minx && v.miny == e.miny && v.maxx == e.maxx && v.maxy == e.maxy) return true; } return false; }; if(contains(range) == false) vec.push_back(range); } } return vec; } But for some reason the recursion is neverending and causing a stack overflow, I have debugged my program and it seems that when this line finishes: extract_bits_locations(bitmap, x + 1, y, x, y, range); It's going for the next line: extract_bits_locations(bitmap, x  1, y, x, y, range); and going back to the first line, and repeat itself. Any idea how I can fix this? And excuse me if this is not the correct place. submitted by /u/therealcain [link] [comments]
 Need help for pseudocodeby /u/yansburth (Algorithm) on June 3, 2020 at 11:38 am
A small shop sells 280 different items. Every item is identified by a 3  digit code. All items which start with a zero (0) are cards, all items which start with a one (1) are sweets, all items which start with a two (2) are stationery and all items which start with a three (3) are toys. Write an algorithm by using a pseudocode, which inputs 3  digit code for all 280 items and outputs the number of cards, sweets, stationery and toys. submitted by /u/yansburth [link] [comments]
 How to solve this problem (Refer to description) involving Bitwise Operations. Basically I need to maximize the given equations by minimizing a particular operand value.by /u/noble_liar17 (Algorithm) on May 7, 2020 at 6:56 am
I am recently stuck with this problem in which I need to find the minimum value of a variable in the given equation in the range [L, R] such that the equation is maximized. The function given is F(X, Y, Z) = (X AND Z) * (Y AND Z), where AND represents bitwiseAND and * represents multiplication. You are given the value of X and Y, and you need to find the minimum value of Z in the range [L, R] (given) such that the F(X, Y, Z) attains the maximum value. Example: Case1: X = 7, Y = 12, L = 4, R = 17 The answer would be Z = 15. When F(7, 12, 15) = (7 AND 15) * (12 AND 15) = 84, which is the maximum value you can get for the equation F(7, 12, Z) for Z in [4, 17]. Case2: X = 7, Y = 12, L = 0, R = 8 The answer would be Z = 7. When F(7, 12, 7) = (7 AND 7) * (12 AND 7) = 28, which is the maximum value you can get for the equation F(7, 12, Z) for Z in [0, 8]. After spending some time with the problem, I found out the following insights which are: Z = X OR Y will give the minimum value for Z by maximizing F(X, Y, Z). If Z = X OR Y lies in the range [L, R], then return X OR Y. Now the problem which I am facing is how to handle the cases when X OR Y < [L, R] and X OR Y > [L. R]. Can anyone help me in figuring out how to build the solution to the problem using Bitwise operations? Constraints: 0 <= L <= R <= 10^12 0 <= X, Y <= 10^12. NOTE: Brute approach of iterating over each and every value in the range [L, R] will take more time when the difference in R  L is huge i.e of the order of >= 10^8. UPD1: Can anyone tell me how to approach the above problem, it's been more than 1day since I posted. submitted by /u/noble_liar17 [link] [comments]
 How can I solve the problem (refer to the description), I am not able to come up with an efficient way of solving it.by /u/noble_liar17 (Algorithm) on May 5, 2020 at 5:33 am
I was trying to solve a program from a programming contest, and I am having a hard time coming up with a much better algorithm than bruteforce in order to solve the problem efficiently. Problem Statement Given a permutation of a sequence from 1 to N and you are only allowed to do the following operations: You can choose three indexes (valid) not necessarily in increasing order but the values in the index must be pairwise distinct. Let's assume the value stored at the indexes as v1, v2, v3, and you are only allowed to circular rightrotate by 1 i.e. after circular right rotation of v1, v2, and v3, we get v3, v1, v2. Example: S = {1, 4, 3, 2, 5} then if I choose the indexes i1 = 2, i2 = 4, i3 = 5, then v1 = 4, v2 = 2, v3 = 5, then after circularrightrotation I will get (5, 4, 2) and S = {1, 5, 3, 4, 2}. Hope the problem is clear now. If not let me know in the comments. I need to develop an algorithm that tells whether it is possible to sort the given permutation by the above operations. If it is possible to sort the sequence then print the steps i.e. what indexes (i1, i2, i3) were chosen in every step to sort the data. Example: S = {3,2,4,1} then it is possible to sort the sequence S by choosing the indexes (1, 3, 4). In this case, only one operation is needed to sort the data. Constraints: Size of the sequence can as large as 10^5. There is no repetitions of the data and every element of the sequence will lie between 1 and N. Can anyone tell me how to approach this problem in order to arrive at an efficient solution? It would be great if someone can provide me a brief intuition (mathematically) behind their approach to the solution. Thanks submitted by /u/noble_liar17 [link] [comments]
 Algorithm to use in finding items that placed consecutively within an hour or less.by /u/pnx_lee (Algorithm) on March 30, 2020 at 9:04 am
submitted by /u/pnx_lee [link] [comments]
 Help finding an algorithm I read aboutby /u/DigitalChupacabra (Algorithm) on January 20, 2020 at 12:25 pm
A while ago I read about an algorithm developed by one of the members of the Manhattan projects at Los Alamos, by which you could find your optimal item on a given restaurants menu. From what I remember you would try some number of items on the menu (the square root of the total items maybe?) and then from those items pick your favorite. I am hoping someone knows more and can point me to it, or in the right direction. I wasn't sure where to ask but figured here and /r/math were the best starts. submitted by /u/DigitalChupacabra [link] [comments]