Comparison of Data structures and Python support

Comparison between different data structures  Each data structure has it’s own different way, or different algorithm for sorting, inserting, finding, …etc. This is due to the nature of the data structure. There are algorithms used with specific data structure, where some other can’t be used. The more efficient & suitable the algorithm, the more you … Continue reading Comparison of Data structures and Python support

What Is A Data Structure?

When we have a programming problem, we dive into the algorithm, while ignoring the underlying data structure. And even worse, we think that using another data structure won’t make much of a difference, although we could vastly improve the performance of our code by picking an alternative data structure. This post is gonna be long. … Continue reading What Is A Data Structure?

Google Coding Problem- #001

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same element twice.Example:Given nums = [2, 7, 11, 15], target = 9,Because nums[0] + nums[1] = 2 + 7 … Continue reading Google Coding Problem- #001

Kadane’s algorithm – (Largest Sum Contiguous Sub-array)

Kadane’s algorithm is to look for all positive contiguous segments of the array (max_ending_here is used for this). And keep track of maximum sum contiguous segment among all positive segments (max_so_far is used for this). Each time we get a positive sum compare it with max_so_far and update max_so_far if it is greater than max_so_far … Continue reading Kadane’s algorithm – (Largest Sum Contiguous Sub-array)

Lambda- Anonymous Functions

Anonymous function means that a function is without a name. As we already know that def keyword is used to define the normal functions and the lambda keyword is used to create anonymous functions. It has the following syntax: lambda arguments: expression This function can have any number of arguments but only one expression, which is evaluated and returned.One … Continue reading Lambda- Anonymous Functions