New: data-structuresAll contenthive-129948krhive-196917zzanhive-183959hive-180932hive-166405hive-185836steemhive-150122hive-101145photographyhive-183397hive-144064uncommonlabhive-184714hive-188619krsuccesshive-145157bitcoinhive-193637hive-103599hive-193186lifehive-180301TrendingNewHotLikerscryptoizotx (40)in programming • 6 years agoOne algorithm a day: Keeping track of the largest element in a stackImagine that you want to be able to access the largest element in a stack. I know you were dying to do it ! You already have implementation of the stack class: class Stack {cryptoizotx (40)in swift • 6 years agoOne algorithm a day. Write a function that returns best profit you could made from trading.Write an efficient function that takes stockPrices and returns the best profit I could have made from one purchase and one sale of one share of Apple stock yesterday.cryptoizotx (40)in programming • 6 years agoOne algorithm a day: floor of the square root of the inputDescription Implement a function that takes in a 32 bit integer and returns another 32 bit unsigned integer that is the floor of the square root of the input Implementation Function can be…jordaan01 (25)in dmania • 7 years agoLinked listView post on dManiaivlad (25)in programming • 7 years agoThe Sieve of Eratosthenes Part 1: efficiently generating primes up to nThe Sieve of Eratosthenes is an algorithm for finding prime numbers in a range. Conceptually, it's a very simple algorithm. Let's assume our range is always [2, n]. In our examples, we'll consider…justyy (82)in programming • 7 years agoACM题解系列之 - 最小堆栈 (Min Stack) - Design a Stack with constant time in Push, Pop and MinImplement a stack with min() function, which will return the smallest number in the stack. It should support push, pop and min operation all in O(1) cost. class MinStack { black-ice (25)in computer-science • 7 years agosteemCreated with Sketch.What's a Merkle Tree?Each node in the Merkle tree performs MD5 hashing of input data. Parent nodes concatenate the hashes of their children before hashing. (Credit: T. L. Oliver CC BY-SA 4.0 ) If you've tried to…orcunland (6)in data-structures • 7 years agoWhy do we only use C in data structures and not C++?Data Structures are particular way of organizing data in a computer so that it can be used efficiently. (Wikipedia Definition) So you can not state that it must be done only in one programming…amos1969 (56)in coding • 7 years agoData Structures in Python - Part 2 - QueuesQueues in Python A Queue A queue is another of the standard data structures that we find throughout Computer Science. Unlike the stack, the queue is a FIFO structure (First In First Out).…amos1969 (56)in coding • 7 years agoData Structures in Python - Part 1- StacksStacks in Python A Stack A stack is a standard computer science data structure that can be described as LIFO (Last In First Out). We "stack" each data item on top of the previous one…