Professional Documents
Culture Documents
DataStructuresGeeksforGeeks
DataStructures
Topics:
LinkedList
Stack
Queue
BinaryTree
BinarySearchTree
Heap
Hashing
Graph
AdvancedDataStructure
Array
Matrix
Misc
LinkedList:
SinglyLinkedList:
IntroductiontoLinkedList
LinkedListvsArray
LinkedListInsertion
LinkedListDeletion
AProgrammersapproachoflookingatArrayvs.LinkedList
FindLengthofaLinkedList(IterativeandRecursive)
SearchanelementinaLinkedList(IterativeandRecursive)
HowtowriteCfunctionsthatmodifyheadpointerofaLinkedList?
WriteafunctiontogetNthnodeinaLinkedList
Givenonlyapointertoanodetobedeletedinasinglylinkedlist,howdo
youdeleteit?
Printthemiddleofagivenlinkedlist
NthnodefromtheendofaLinkedList
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1em
1/20
14/06/2015
DataStructuresGeeksforGeeks
WriteafunctiontodeleteaLinkedList
Writeafunctionthatcountsthenumberoftimesagivenintoccursina
LinkedList
Reversealinkedlist
Detectloopinalinkedlist
Functiontocheckifasinglylinkedlistispalindrome
Givenalinkedlistwhichissorted,howwillyouinsertinsortedway
IntersectionpointoftwoLinkedLists.
RecursivefunctiontoprintreverseofaLinkedList
Removeduplicatesfromasortedlinkedlist
Removeduplicatesfromanunsortedlinkedlist
Pairwiseswapelementsofagivenlinkedlist
PracticequestionsforLinkedListandRecursion
MovelastelementtofrontofagivenLinkedList
IntersectionoftwoSortedLinkedLists
DeletealternatenodesofaLinkedList
AlternatingsplitofagivenSinglyLinkedList
Mergetwosortedlinkedlists
IdenticalLinkedLists
MergeSortforLinkedLists
ReverseaLinkedListingroupsofgivensize
ReversealternateKnodesinaSinglyLinkedList
Deletenodeswhichhaveagreatervalueonrightside
SegregateevenandoddnodesinaLinkedList
DetectandRemoveLoopinaLinkedList
Addtwonumbersrepresentedbylinkedlists|Set1
DeleteagivennodeinLinkedListundergivenconstraints
UnionandIntersectionoftwoLinkedLists
Findatripletfromthreelinkedlistswithsumequaltoagivennumber
RotateaLinkedList
FlatteningaLinkedList
Addtwonumbersrepresentedbylinkedlists|Set2
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1em
2/20
14/06/2015
DataStructuresGeeksforGeeks
Sortalinkedlistof0s,1sand2s
Flattenamultilevellinkedlist
DeleteNnodesafterMnodesofalinkedlist
QuickSortonSinglyLinkedList
Mergealinkedlistintoanotherlinkedlistatalternatepositions
Pairwiseswapelementsofagivenlinkedlistbychanginglinks
Givenalinkedlistoflinesegments,removemiddlepoints
ConstructaMaximumSumLinkedListoutoftwoSortedLinkedLists
havingsomeCommonnodes
CanwereversealinkedlistinlessthanO(n)?
Clonealinkedlistwithnextandrandompointer|Set2
InsertionSortforSinglyLinkedList
Pointtonexthighervaluenodeinalinkedlistwithanarbitrarypointer
CircularLinkedList:
CircularLinkedListIntroductionandApplications,
CircularLinkedListTraversal
SplitaCircularLinkedListintotwohalves
Sortedinsertforcircularlinkedlist
DoublyLinkedList:
DoublyLinkedListIntroductionandInsertion
DeleteanodeinaDoublyLinkedList
ReverseaDoublyLinkedList
TheGreatTreeListRecursionProblem.
Copyalinkedlistwithnextandarbitpointer
QuickSortonDoublyLinkedList
SwapKthnodefrombeginningwithKthnodefromendinaLinkedList
QuizonLinkedList
Stack:
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1em
3/20
14/06/2015
DataStructuresGeeksforGeeks
IntroductiontoStack
InfixtoPostfixConversionusingStack
EvaluationofPostfixExpression
ReverseaStingusingStack
Implementtwostacksinanarray
Checkforbalancedparenthesesinanexpression
NextGreaterElement
Reverseastackusingrecursion
TheStockSpanProblem
DesignandImplementSpecialStackDataStructure
ImplementStackusingQueues
Designastackwithoperationsonmiddleelement
Howtocreatemergablestack?
Howtoefficientlyimplementkstacksinasinglearray?
IterativeTowerofHanoi
QuizonStack
Queue:
QueueIntroductionandArrayImplementation
LinkedListImplementationofQueue
ApplicationsofQueueDataStructure
PriorityQueueIntroduction
Deque(IntroductionandApplications)
ImplementQueueusingStacks
CheckwhetheragivenBinaryTreeisCompleteornot
Findthelargestmultipleof3
Findthefirstcirculartourthatvisitsallpetrolpumps
Maximumofallsubarraysofsizek
AnInterestingMethodtoGenerateBinaryNumbersfrom1ton
HowtoefficientlyimplementkQueuesinasinglearray?
QuizonQueue
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1em
4/20
14/06/2015
DataStructuresGeeksforGeeks
BinaryTree:
BinaryTreeIntroduction
HandshakingLemmaandInterestingTreeProperties
BinaryTreeProperties
TypesofBinaryTree
Applicationsoftreedatastructure
TreeTraversals
ThreadedBinaryTree
Sizeofatree
DetermineifTwoTreesareIdentical
MaximumDepthorHeightofaTree
WriteaCprogramtoDeleteaTree.
WriteanEfficientCFunctiontoConvertaBinaryTreeintoitsMirrorTree
Ifyouaregiventwotraversalsequences,canyouconstructthebinary
tree?
Givenabinarytree,printoutallofitsroottoleafpathsoneperline.
TheGreatTreeListRecursionProblem.
LevelOrderTreeTraversal
Countleafnodesinabinarytree
Levelordertraversalinspiralform
CheckforChildrenSumPropertyinaBinaryTree.
ConvertanarbitraryBinaryTreetoatreethatholdsChildrenSum
Property
DiameterofaBinaryTree
Howtodetermineifabinarytreeisheightbalanced?
InorderTreeTraversalwithoutRecursion
InorderTreeTraversalwithoutrecursionandwithoutstack!
Roottoleafpathsumequaltoagivennumber
ConstructTreefromgivenInorderandPreordertraversals
Givenabinarytree,printallroottoleafpaths
DoubleTree
Maximumwidthofabinarytree
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1em
5/20
14/06/2015
DataStructuresGeeksforGeeks
FoldableBinaryTrees
Printnodesatkdistancefromroot
GetLevelofanodeinaBinaryTree
PrintAncestorsofagivennodeinBinaryTree
CheckifagivenBinaryTreeisSumTree
Checkifabinarytreeissubtreeofanotherbinarytree
Connectnodesatsamelevel
Connectnodesatsamelevelusingconstantextraspace
PopulateInorderSuccessorforallnodes
ConvertagiventreetoitsSumTree
VerticalSuminagivenBinaryTree
FindthemaximumsumleaftorootpathinaBinaryTree
ConstructSpecialBinaryTreefromgivenInordertraversal
Constructaspecialtreefromgivenpreordertraversal
CheckwhetheragivenBinaryTreeisCompleteornot
BoundaryTraversalofbinarytree
ConstructFullBinaryTreefromgivenpreorderandpostordertraversals
IterativePreorderTraversal
MorristraversalforPreorder
Linkedcompletebinarytree&itscreation
TernarySearchTree
SegmentTree|Set1(Sumofgivenrange)
LargestIndependentSetProblem
IterativePostorderTraversal|Set1(UsingTwoStacks)
IterativePostorderTraversal|Set2(UsingOneStack)
ReverseLevelOrderTraversal
ConstructCompleteBinaryTreefromitsLinkedListRepresentation
ConvertagivenBinaryTreetoDoublyLinkedList|Set1
TreeIsomorphismProblem
Findallpossibleinterpretationsofanarrayofdigits
IterativeMethodtofindHeightofBinaryTree
CustomTreeProblem
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1em
6/20
14/06/2015
DataStructuresGeeksforGeeks
ConvertagivenBinaryTreetoDoublyLinkedList|Set2
Printancestorsofagivenbinarytreenodewithoutrecursion
DifferencebetweensumsofoddlevelandevenlevelnodesofaBinary
Tree
PrintPostordertraversalfromgivenInorderandPreordertraversals
Finddepthofthedeepestoddlevelleafnode
Checkifallleavesareatsamelevel
PrintLeftViewofaBinaryTree
Removeallnodeswhichdontlieinanypathwithsum>=k
ExtractLeavesofaBinaryTreeinaDoublyLinkedList
Deepestleftleafnodeinabinarytree
Findnextrightnodeofagivenkey
Sumofallthenumbersthatareformedfromroottoleafpaths
ConvertagivenBinaryTreetoDoublyLinkedList|Set3
LowestCommonAncestorinaBinaryTree|Set1
FinddistancebetweentwogivenkeysofaBinaryTree
Printallnodesthatareatdistancekfromaleafnode
CheckifagivenBinaryTreeisheightbalancedlikeaRedBlackTree,
Printallnodesatdistancekfromagivennode
PrintaBinaryTreeinVerticalOrder|Set1
ConstructatreefromInorderandLevelordertraversals
Findthemaximumpathsumbetweentwoleavesofabinarytree
Reversealternatelevelsofaperfectbinarytree
CheckiftwonodesarecousinsinaBinaryTree
Checkifabinarytreeissubtreeofanotherbinarytree|Set2
SerializeandDeserializeaBinaryTree
Printnodesbetweentwogivenlevelnumbersofabinarytree
closestleafinaBinaryTree
ConvertaBinaryTreetoThreadedbinarytree
PrintNodesinTopViewofBinaryTree
BottomViewofaBinaryTree
PerfectBinaryTreeSpecificLevelOrderTraversal
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1em
7/20
14/06/2015
DataStructuresGeeksforGeeks
Convertleftrightrepresentationofabianrytreetodownright
Printlevelordertraversallinebyline
Minimumno.ofiterationstopassinformationtoallnodesinthetree
CloneaBinaryTreewithRandomPointers
Givenabinarytree,howdoyouremoveallthehalfnodes?
VertexCoverProblem|Set2(DynamicProgrammingSolutionforTree)
Checkwhetherabinarytreeisafullbinarytreeornot
FindsumofallleftleavesinagivenBinaryTree
Removenodesonroottoleafpathsoflength<K
IterativeSearchforakeyxinBinaryTree
Findmaximum(orminimum)inBinaryTree
QuizonBinaryTree
QuizonBinaryTreeTraversals
AllarticlesonTree
BinarySearchTree:
SearchandInsertinBST
DeletionfromBST
MinimumvalueinaBinarySearchTree
InorderpredecessorandsuccessorforagivenkeyinBST
CheckifabinarytreeisBSTornot
LowestCommonAncestorinaBinarySearchTree.
SortedorderprintingofagivenarraythatrepresentsaBST
InorderSuccessorinBinarySearchTree
FindkthsmallestelementinBST(OrderStatisticsinBST)
PrintBSTkeysinthegivenrange
SortedArraytoBalancedBST
FindthelargestBSTsubtreeinagivenBinaryTree
CheckforIdenticalBSTswithoutbuildingthetrees
AddallgreatervaluestoeverynodeinagivenBST
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1em
8/20
14/06/2015
DataStructuresGeeksforGeeks
RemoveBSTkeysoutsidethegivenrange
CheckifeachinternalnodeofaBSThasexactlyonechild
FindifthereisatripletinaBalancedBSTthataddstozero
MergetwoBSTswithlimitedextraspace
TwonodesofaBSTareswapped,correcttheBST
ConstructBSTfromgivenpreordertraversal|Set1
ConstructBSTfromgivenpreordertraversal|Set2
FloorandCeilfromaBST
ConvertaBSTtoaBinaryTreesuchthatsumofallgreaterkeysisadded
toeverykey
SortedLinkedListtoBalancedBST
InplaceconversionofSortedDLLtoBalancedBST
FindapairwithgivensuminaBalancedBST
TotalnumberofpossibleBinarySearchTreeswithnkeys
MergeTwoBalancedBinarySearchTrees
BinaryTreetoBinarySearchTreeConversion
TransformaBSTtogreatersumtree
InorderpredecessorandsuccessorforagivenkeyinBST
KthLargestElementinBSTwhenmodificationtoBSTisnotallowed
HowtohandleduplicatesinBinarySearchTree?
QuizonBinarySearchTrees
QuizonBalancedBinarySearchTrees
Heap:
BinaryHeap
BinomialHeap
HeapSort
KthLargestElementinanarray
Sortanalmostsortedarray/
Sortanalmostsortedarray/
TournamentTree(WinnerTree)andBinaryHeap
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1em
9/20
14/06/2015
DataStructuresGeeksforGeeks
Hashing:
HashingIntroduction
PrintaBinaryTreeinVerticalOrder
Findwhetheranarrayissubsetofanotherarray
UnionandIntersectionoftwoLinkedLists
Findapairwithgivensum
Checkifagivenarraycontainsduplicateelementswithinkdistancefrom
eachother
FindItineraryfromagivenlistoftickets
FindnumberofEmployeesUndereveryEmployee
QuizonHashing
Graph:
Introduction,DFSandBFS:
Graphanditsrepresentations
BreadthFirstTraversalforaGraph
DepthFirstTraversalforaGraph
ApplicationsofDepthFirstSearch
ApplicationsofBreadthFirstTraversal
DetectCycleinaDirectedGraph
DetectCycleinaanUndirectedGraph
Detectcycleinanundirectedgraph
LongestPathinaDirectedAcyclicGraph
TopologicalSorting
CheckwhetheragivengraphisBipartiteornot
SnakeandLadderProblem
MinimizeCashFlowamongagivensetoffriendswhohaveborrowed
moneyfromeachother
Boggle(Findallpossiblewordsinaboardofcharacters)
Assigndirectionstoedgessothatthedirectedgraphremainsacyclic
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
10/20
14/06/2015
DataStructuresGeeksforGeeks
MinimumSpanningTree:
PrimsMinimumSpanningTree(MST))
ApplicationsofMinimumSpanningTreeProblem
PrimsMSTforAdjacencyListRepresentation
KruskalsMinimumSpanningTreeAlgorithm
BoruvkasalgorithmforMinimumSpanningTree
ShortestPaths:
Dijkstrasshortestpathalgorithm
DijkstrasAlgorithmforAdjacencyListRepresentation
BellmanFordAlgorithm
FloydWarshallAlgorithm
JohnsonsalgorithmforAllpairsshortestpaths
ShortestPathinDirectedAcyclicGraph
Someinterestingshortestpathquestions,
Shortestpathwithexactlykedgesinadirectedandweightedgraph
Connectivity:
Findifthereisapathbetweentwoverticesinadirectedgraph
Connectivityinadirectedgraph
ArticulationPoints(orCutVertices)inaGraph
Biconnectedgraph
Bridgesinagraph
Eulerianpathandcircuit
FleurysAlgorithmforprintingEulerianPathorCircuit
StronglyConnectedComponents
Transitiveclosureofagraph
Findthenumberofislands
Countallpossiblewalksfromasourcetoadestinationwithexactlyk
edges
EulerCircuitinaDirectedGraph
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
11/20
14/06/2015
DataStructuresGeeksforGeeks
BiconnectedComponents
Checkifagivengraphistreeornot
KargersalgorithmforMinimumCut
HardProblems:
GraphColoring(IntroductionandApplications)
GreedyAlgorithmforGraphColoring
TravellingSalesmanProblem(NaiveandDynamicProgramming)
TravellingSalesmanProblem(ApproximateusingMST)
HamiltonianCycle
VertexCoverProblem|Set1(IntroductionandApproximateAlgorithm)
KCentersProblem|Set1(GreedyApproximateAlgorithm)
MaximumFlow:
FordFulkersonAlgorithmforMaximumFlowProblem
Findmaximumnumberofedgedisjointpathsbetweentwovertices
Findminimumstcutinaflownetwork
MaximumBipartiteMatching
ChannelAssignmentProblem
QuizonGraph
QuizonGraphTraversals
QuizonGraphShortestPaths
QuizonGraphMinimumSpanningTree
AdvancedDataStructure:
AdvancedLists:
Memoryefficientdoublylinkedlist
XORLinkedListAMemoryEfficientDoublyLinkedList|Set1
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
12/20
14/06/2015
DataStructuresGeeksforGeeks
XORLinkedListAMemoryEfficientDoublyLinkedList|Set2
SkipList|Set1(Introduction)
SelfOrganizingList|Set1(Introduction)
Trie:
Trie|(InsertandSearch)
Trie|(Delete)
LongestprefixmatchingATriebasedsolutioninJava
Printuniquerowsinagivenbooleanmatrix
HowtoImplementReverseDNSLookUpCache?
HowtoImplementForwardDNSLookUpCache?
SuffixArrayandSuffixTree:
SuffixArrayIntroduction
SuffixArraynLognAlgorithm
SuffixTreeIntroduction
UkkonensSuffixTreeConstructionPart1
UkkonensSuffixTreeConstructionPart2
UkkonensSuffixTreeConstructionPart3
UkkonensSuffixTreeConstructionPart4,
UkkonensSuffixTreeConstructionPart5
UkkonensSuffixTreeConstructionPart6
GeneralizedSuffixTree
BuildLinearTimeSuffixArrayusingSuffixTree
SubstringCheck
SearchingAllPatterns
LongestRepeatedSubstring,
LongestCommonSubstring,LongestPalindromicSubstring
AVLTree:
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
13/20
14/06/2015
DataStructuresGeeksforGeeks
AVLTree|Set1(Insertion)
AVLTree|Set2(Deletion)
AVLwithduplicatekeys
SplayTree:
SplayTree|Set1(Search)
SplayTree|Set2(Insert)
BTree:
BTree|Set1(Introduction)
BTree|Set2(Insert)
BTree|Set3(Delete)
SegmentTree:
SegmentTree|Set1(Sumofgivenrange)
SegmentTree|Set2(RangeMinimumQuery)
RedBlackTree:
RedBlackTreeIntroduction
RedBlackTreeInsertion.
RedBlackTreeDeletion
ProgramforRedBlackTreeInsertion
Others:
TernarySearchTree
IntervalTree
ImplementLRUCache
Sortnumbersstoredondifferentmachines
Findthekmostfrequentwordsfromafile
Givenasequenceofwords,printallanagramstogether
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
14/20
14/06/2015
DataStructuresGeeksforGeeks
TournamentTree(WinnerTree)andBinaryHeap
DecisionTreesFake(Counterfeit)CoinPuzzle(12CoinPuzzle)
SpaghettiStack
DataStructureforDictionaryandSpellChecker?
KDTree
BinomialHeap
KDTree
BinaryIndexedTree
Array:
GivenanarrayA[]andanumberx,checkforpairinA[]withsumasx
MajorityElement
FindtheNumberOccurringOddNumberofTimes
LargestSumContiguousSubarray
FindtheMissingNumber
Searchanelementinasortedandpivotedarray
Mergeanarrayofsizenintoanotherarrayofsizem+n
Medianoftwosortedarrays
Writeaprogramtoreverseanarray
Programforarrayrotation
Reversalalgorithmforarrayrotation
Blockswapalgorithmforarrayrotation
Maximumsumsuchthatnotwoelementsareadjacent
Leadersinanarray
Sortelementsbyfrequency|Set1
CountInversionsinanarray
Twoelementswhosesumisclosesttozero
Findthesmallestandsecondsmallestelementinanarray
CheckforMajorityElementinasortedarray
Maximumandminimumofanarrayusingminimumnumberof
comparisons
Segregate0sand1sinanarray
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
15/20
14/06/2015
DataStructuresGeeksforGeeks
klargest(orsmallest)elementsinanarray|addedMinHeapmethod
Maximumdifferencebetweentwoelements
UnionandIntersectionoftwosortedarrays
FloorandCeilinginasortedarray
AProductArrayPuzzle
SegregateEvenandOddnumbers
Findthetworepeatingelementsinagivenarray
Sortanarrayof0s,1sand2s
FindtheMinimumlengthUnsortedSubarray,sortingwhichmakesthe
completearraysorted
FindduplicatesinO(n)timeandO(1)extraspace
Equilibriumindexofanarray
LinkedListvsArray
Whichsortingalgorithmmakesminimumnumberofmemorywrites?
Turnanimageby90degree
NextGreaterElement
Checkifarrayelementsareconsecutive|AddedMethod3
Findthesmallestmissingnumber
Countthenumberofoccurrencesinasortedarray
InterpolationsearchvsBinarysearch
Givenanarrayarr[],findthemaximumjisuchthatarr[j]>arr[i]
Maximumofallsubarraysofsizek(AddedaO(n)method)
Findwhetheranarrayissubsetofanotherarray|AddedMethod3
Findtheminimumdistancebetweentwonumbers
Findtherepeatingandthemissing|Added3newmethods
Medianinastreamofintegers(runningintegers)
FindaFixedPointinagivenarray
MaximumLengthBitonicSubarray
Findthemaximumelementinanarraywhichisfirstincreasingandthen
decreasing
Countsmallerelementsonrightside
Minimumnumberofjumpstoreachend
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
16/20
14/06/2015
DataStructuresGeeksforGeeks
Implementtwostacksinanarray
Findsubarraywithgivensum
DynamicProgramming|Set14(MaximumSumIncreasingSubsequence)
LongestMonotonicallyIncreasingSubsequenceSize(NlogN)
Findatripletthatsumtoagivenvalue
Findthesmallestpositivenumbermissingfromanunsortedarray
Findthetwonumberswithoddoccurrencesinanunsortedarray
TheCelebrityProblem
DynamicProgramming|Set15(LongestBitonicSubsequence)
Findasortedsubsequenceofsize3inlineartime
Largestsubarraywithequalnumberof0sand1s
DynamicProgramming|Set18(Partitionproblem)
MaximumProductSubarray
Findapairwiththegivendifference
Replaceeveryelementwiththenextgreatest
DynamicProgramming|Set20(MaximumLengthChainofPairs)
Findfourelementsthatsumtoagivenvalue|Set1(n^3solution)
Findfourelementsthatsumtoagivenvalue|Set2(O(n^2Logn)
Solution)
Sortanearlysorted(orKsorted)array
Maximumcircularsubarraysum
Findtherowwithmaximumnumberof1s
Medianoftwosortedarraysofdifferentsizes
Shuffleagivenarray
Countthenumberofpossibletriangles
IterativeQuickSort
Findthenumberofislands
ConstructionofLongestMonotonicallyIncreasingSubsequence(NlogN)
Findthefirstcirculartourthatvisitsallpetrolpumps
Arrangegivennumberstoformthebiggestnumber
Pancakesorting
APancakeSortingProblem
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
17/20
14/06/2015
DataStructuresGeeksforGeeks
TugofWar
DivideandConquer|Set3(MaximumSubarraySum)
CountingSort
MergeOverlappingIntervals
FindthemaximumrepeatingnumberinO(n)timeandO(1)extraspace
StockBuySelltoMaximizeProfit
RearrangepositiveandnegativenumbersinO(n)timeandO(1)extra
space
Sortelementsbyfrequency|Set2
Findapeakelement
Printallpossiblecombinationsofrelementsinagivenarrayofsizen
Givenanarrayofofsizenandanumberk,findallelementsthatappear
morethann/ktimes
Findthepointwhereamonotonicallyincreasingfunctionbecomespositive
firsttime
FindtheIncreasingsubsequenceoflengththreewithmaximumproduct
Findtheminimumelementinasortedandrotatedarray
StableMarriageProblem
Mergeksortedarrays|Set1
RadixSort
Moveallzeroestoendofarray
Findnumberofpairssuchthatx^y>y^x
Countalldistinctpairswithdifferenceequaltok
Findifthereisasubarraywith0sum
Smallestsubarraywithsumgreaterthanagivenvalue
Sortanarrayaccordingtotheorderdefinedbyanotherarray
MaximumSumPathinTwoArrays
Checkifagivenarraycontainsduplicateelementswithinkdistancefrom
eachother
Sortanarrayinwaveform
KthSmallest/LargestElementinUnsortedArray,KthSmallest/Largest
ElementinUnsortedArrayinExpectedLinearTime,
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
18/20
14/06/2015
DataStructuresGeeksforGeeks
KthSmallest/LargestElementinUnsortedArrayinWorstCaseLinear
Time
FindIndexof0tobereplacedwith1togetlongestcontinuoussequence
of1sinabinaryarray
Findtheclosestpairfromtwosortedarrays
Givenasortedarrayandanumberx,findthepairinarraywhosesumis
closesttox
Count1sinasortedbinaryarray
PrintAllDistinctElementsofagivenintegerarray
Constructanarrayfromitspairsumarray
Findcommonelementsinthreesortedarrays
Findthefirstrepeatingelementinanarrayofintegers
Findthesmallestpositiveintegervaluethatcannotberepresentedassum
ofanysubsetofagivenarray
Rearrangeanarraysuchthatarr[j]becomesiifarr[i]isj
Findpositionofanelementinasortedarrayofinfinitenumbers
CanQuickSortbeimplementedinO(nLogn)worstcasetimecomplexity?
Checkifagivenarraycontainsduplicateelementswithinkdistancefrom
eachother
Findtheelementthatappearsonce
Replaceeveryarrayelementbymultiplicationofpreviousandnext
Checkifanytwointervalsoverlapamongagivensetofintervals
Deleteanelementfromarray(Usingtwotraversalsandonetraversal)
Givenasortedarrayandanumberx,findthepairinarraywhosesumis
closesttox
Findthelargestpairsuminanunsortedarray
Onlinealgorithmforcheckingpalindromeinastream
FindUnionandIntersectionoftwounsortedarrays
PythagoreanTripletinanarray
Maximumprofitbybuyingandsellingashareatmosttwice
QuizonArray
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
19/20
14/06/2015
DataStructuresGeeksforGeeks
Matrix:
Searchinarowwiseandcolumnwisesortedmatrix
Printagivenmatrixinspiralform
ABooleanMatrixQuestion
Printuniquerowsinagivenbooleanmatrix
Maximumsizesquaresubmatrixwithall1s
Printuniquerowsinagivenbooleanmatrix
InplaceMxNsizematrixtranspose|Updated
PrintMatrixDiagonally
DynamicProgramming|Set27(Maximumsumrectangleina2Dmatrix)
StrassensMatrixMultiplication
CreateamatrixwithalternatingrectanglesofOandX
Findtherowwithmaximumnumberof1s
Printallelementsinsortedorderfromrowandcolumnwisesortedmatrix
Givenannxnsquarematrix,findsumofallsubsquaresofsizekxk
Countnumberofislandswhereeveryislandisrowwiseandcolumnwise
separated
Findacommonelementinallrowsofagivenrowwisesortedmatrix
GivenamatrixofOandX,replaceOwithXifsurroundedbyX
Misc:
CommonlyAskedDataStructureInterviewQuestions|Set1
AdatastructurefornelementsandO(1)operations
YoucancreateanewDataStructuretopicanddiscussitwithothergeeks
usingGeeksforgeeksQ&Apage.SeealreadydiscussedDataStructure
questionsonforum.
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22pageinfo%22%20style%3D%22height%3A%2023.3333339691162px%3B%20fontsize%3A%201.1e
20/20