KodeKnight

Data structures, Algorithms, Coding, Technical Interview Questions and much more. (Still work in progress)

TwitterFacebookGoogle PlusLinkedInRSS FeedEmail
  • Home
  • DataStructures
    • Topics
    • Stack
    • Queue
    • Linked List
      • SinglyLinkedList
      • DoublyLinkedList
    • BST
    • Heap
    • Graph
    • Balanced BST
      • AVL Tree
      • RBT Tree
    • Trie
    • Hashtable
  • Algorithms
    • Sorting
    • Divide And Conquer
    • Decrease and Conquer
    • Dynamic Programming
    • Greedy Algorithm
    • Backtracking algorithm
    • Randomized Algorithm
  • Misc
    • Cracking the Coding Interview
    • Arrays
    • Bit Manipulation
    • String
    • Linux/Unix Notes
  • Companies
    • Amazon
    • Google
    • Microsoft
  • Other Topics
    • Angular JS

Like Us

Followers

Topics

  • Algorithms
  • CrackingTheCodingInterview
  • Data Structure
  • Dynamic Programming / DP
  • Interview Question
  • Object oriented programming / OOP
  • Operating System / OS
  • Single Link List
  • String
  • array
  • brainteaser
  • object-oriented-design / OOD

Books for You

  • 2 Sum Problem : Given an integer array and a number T, find all unique pairs of (a, b) whose sum is equal to T
    This updated information has been further expanded upon on my new website. You can find the updated details here: https://k5kc.com/cs/...
  • Design a chess game using OO principles
    Problem Design a chess game using object oriented principles. Solution The Chess game has the following classes Board Player Pie...
  • Rotate n * n matrix by 90 degrees
    This updated information has been further expanded upon on my new website. You can find the updated details here: https://k5kc.com/cs/...
  • Cracking the coding interview questions
    The book - cracking the coding interview has list of questions. The list of questions and solutions is not comprehensive, but I guess that ...
  • Implement a jigsaw puzzle
    Implement a jigsaw puzzle. Design the data structures and explain an algorithm to solve the puzzle. In jigsaw puzzles we take the piece,...
  • Hash Tables
    A hash table is primarily used to keep track of an evolving set of stuff by using a key. It is good for inserting, deleting, and lookups. ...
  • Design a vending machine like coffee vending machine
    This updated information has been further expanded upon on my new website. You can find the updated details here: https://k5kc.com/c...
  • Implement Add,Subtract,Multiplication,Division Using Bit Manipulation
    Addition This One is Somewhat Logical and the Best also. This will work all kind of Inputs. The Logic Behind the Concept is described brei...
  • All permutations of a string
    Problem Write a method to compute all permutations of a string. Example For a string of length n, there are n! permutations. INPUT: ...
  • Print binary search tree in increasing order
    This updated information has been further expanded upon on my new website. You can find the updated details here: https://k5kc.com/c...

Contributors

  • Kinshuk Chandra
  • Rekha Kumari

Search This Blog

  • ()
  • ()
Show more Show less
Powered by Blogger.

Labels

2DArray (6) 2DSortedArray (3) 2Sum (3) AbstractDataType/ADT (6) Adjacency (1) AdjacencyList (1) Adobe (8) AlgorithmAnalysis (3) Algorithms (78) Amazon (22) Amortize (1) anagrams (7) angular (1) application (2) aptitude (5) AptitudeConcepts (2) ArithematicPuzzle (3) array (68) ArraySearch (9) AsymptoticUpperBound (1) average (1) avl (7) b-tree (1) backtracking (9) balanced trees (19) balls (2) bank-bazaar (1) beautiful codes (1) BFS (10) big data (1) Big Omega (1) binary array (4) binary search (10) Binary Search Tree / BST (59) Binary Tree / BT (19) binary-sort (1) Bit Vector (2) bitonic (1) bits (38) blog (1) boolean (2) bottom-up (1) brainteaser (142) Breadth-First Traversal (1) browserstack (1) bubble sort (4) Bucket Sort (1) c (34) c implementation (1) c# (1) cache (2) calloc (1) catalan (1) celebrity (2) check (3) chess (1) circular stack (1) cleaner code (4) cloud computing (1) coding (1) coding style (5) coin (2) Combination (1) common math functions (1) companies (3) compare (3) Comparison Sort (3) Complete Binary tree (1) compression (2) concatenate (1) concurrency (3) confused (1) connectivity (3) console input (1) const (1) const functions (2) constructors (2) contiguous (1) conversion (18) coordinate geometry (6) count (13) counting-sort (1) cpp (43) cpp vs java (2) cppimpl (2) CrackingTheCodingInterview (149) Cram it (1) cryptography (2) cTricks (2) cut (2) Data Structure (41) Data Structure Templates (4) data types (4) Database (9) date-time (1) db-design (3) declarations (1) define (4) delete (5) Depth-First Traversal (1) deque (2) destructor (1) DFS (6) differences (1) dijkshtra (1) Directed Graph (3) directi (3) distance (10) Distribution Sort (1) divide and conquer (12) DLL/Doubly Linked List (10) double link list (1) DS / Data Structures (34) DS Concepts (2) duplicate (25) dynamic allocation (8) dynamic arrays (1) Dynamic Programming / DP (48) encoding (3) endianness (1) enum (2) errors (1) exceptions (1) exit (1) expressions (1) external sort (1) fab.com (3) facebook (1) factor (1) factorization (5) fast pointer (3) fibonacci (1) File handling (6) fileIO (2) fileRead (2) files (1) flipkart (4) floating point values (1) formatting-needed (2) frequency (1) fun (1) functions (2) game (1) generic classes (2) geometric-search (3) gist (1) git (2) github (3) good practice (1) google (4) goto (2) Graph (22) graph-search (11) graphics (3) greater (1) greedy Algo (7) grep (1) hackerrank (1) hard (12) hashes (4) hashmap (1) hashtable (8) heap (10) hiding (1) histogram (1) identical (1) If statement (1) ImplementOperatorWithConditions (1) In-place sorting (1) incomplete (112) increasing-sequence (1) inmobi (4) inorder (12) inorder successor (3) Inorder traversal (6) Input (2) Input Output / IO (5) insertion-sort (5) integer (13) integer series (1) integer-array (4) integer-sort (6) intersection (4) interval (4) interview (24) Interview Question (15) interview-set (4) inversion (1) iterative (5) jabong (2) java (35) Java Arrays (1) java-code (8) K-Distance (3) k5kced (10) kadane (1) keyword (1) KMP algorithm (2) knapsack problem (2) kodeknight (1034) kth-largest (6) largest (6) LCA/Least Common Ancestor (2) LCS (1) leetcode (1) level-order-traversal (4) library functions (1) limited memory (9) Linear datastructure (1) link list (31) linkage (1) linked list (12) linux / unix (53) list (1) local-minima (1) logical questions (1) loop (4) Looping construct (1) Low Level (10) macro (1) malloc (1) map-reduce (2) master-method (4) match string (1) Mathematical (5) mathematics (3) maths (22) matrix (7) matrix-multiplication (2) max (15) maxima (2) maze (1) median (3) medium (1) memoization (2) memory leaks (1) memory management (6) merge (13) merge-sort (5) Microsoft (8) middle (1) min (15) min-heap (2) mincut (2) minima (2) minimum spanning tree / mst (1) minmax (5) mirror (1) Moderate (9) morgan-stanley (3) multiplication (1) networking (13) next-big-number (2) non-linear datastructure (1) non-linear datastrucutre (1) number (2) number theory (2) number theoryQ (1) O(1) (2) Object oriented programming / OOP (1) object-oriented-design / OOD (14) Omega Time complexity (2) Operating System / OS (8) operations (2) operators (6) optimization (1) overflow (1) overloading (1) overriding (1) Page (21) pair (1) palindrome (6) parentheses (3) parse (1) partition (1) pascal (1) path (1) pathological data (1) pattern matching (7) Permutation (4) Permutation and Combination (4) plane (1) pointers (14) polymorphism (1) polynomial (1) postorder (5) Postorder traversal (2) powerOf2 (3) Predefined Values in headers (1) preorder (4) Preorder traversal (2) preprocessor (5) prime (9) prime-factor (5) PriorityQueue (3) probability (8) process (2) product (2) programCPP (9) programming (19) programming language / PL (1) programming Questions (4) programs (3) progression (1) projecteuler (2) psychometry test (1) Puzzles (29) pythagorean triplet (1) queen (1) queue (11) quicksort (7) quiz (1) radix-sort (1) random (4) randomized algorithm (3) range (2) ranged-array (8) rbt / red black tree (6) rectangle (6) recursion (35) references (3) regular expression (1) Relational Database (1) Remember (1) remove-duplicates (5) replace (1) Resources (2) reverse (12) rotated array (6) scanf (1) scoping (1) search (18) search string (1) second-largest (1) selection (4) Selection Sort (3) selection-sort (1) sequence (2) Sequential statement (1) series (2) shell-sort (1) shortest-path (4) shuffle (2) Single Link List (32) size (1) skip-list (3) smallest (4) snapdeal (1) Software Engg (6) sorted-array (17) sorted-list (1) sorting (50) Sorting Algorithm (4) sorting arrays (3) sorting-and-searching (7) spaces (2) spanning tree (1) Special Nos. (5) square matrix (1) squares (1) stack (33) STL (2) stock (3) stream (1) String (58) string-search (4) string-udf (5) StringAlgo (7) sub-array (2) subsequence (7) subset (3) substring (7) suffix tree (1) sum (3) swap (5) sweep-line (1) System Design And Memory Limits (7) templates (1) Testing (6) text editors (1) theory (3) thread (1) Threaded binary Tree (1) Threads and Locks (9) time (2) time complexity (14) toc2 (1) top-down (1) traversal (14) tree (57) trie (10) twin-prime (1) two-arrays (6) two-lists (1) two-sorted-arrays (7) two-string (2) udf (4) ugly-number (1) UML (1) understand (12) Undirected Graph (2) union (2) union-find (1) unique (5) unsorted-array (8) useful linux commands (17) UX (1) variable argument functions (1) variables (1) vdopia (1) vectors_cpp (1) verbal (2) vi editor (1) virtual function (1) virtualization (4) vmware (2) vocab (1) web (1) window (3) xml (1) xor (1) yahoo (3) zero (5) zigzag (1)

Report Abuse

  • Home

Blog Archive

  • ►  2016 (3)
    • ►  March (3)
  • ►  2015 (22)
    • ►  September (6)
    • ►  June (3)
    • ►  May (6)
    • ►  April (6)
    • ►  February (1)
  • ►  2014 (421)
    • ►  November (1)
    • ►  October (2)
    • ►  September (1)
    • ►  July (79)
    • ►  June (11)
    • ►  May (89)
    • ►  April (90)
    • ►  March (81)
    • ►  February (21)
    • ►  January (46)
  • ►  2013 (88)
    • ►  November (6)
    • ►  October (6)
    • ►  September (7)
    • ►  August (46)
    • ►  July (23)
  • ►  2012 (67)
    • ►  February (1)
    • ►  January (66)
  • ►  2011 (139)
    • ►  December (55)
    • ►  October (26)
    • ►  September (29)
    • ►  June (1)
    • ►  May (21)
    • ►  March (1)
    • ►  February (6)
  • ▼  2010 (175)
    • ►  October (14)
    • ►  September (17)
    • ►  August (41)
    • ►  July (22)
    • ▼  April (45)
      • Important ds question
      • Longest common subsequence : Dynamic programming
      • GCD and LCM
      • External Sorting - How do you sort a million 32-bi...
      • maximum index of an array
      • Missing integers
      • print combinations
      • Trie examples
      • Scrabble algorithm
      • Permutations and Combinations of string
      • Tries
      • superstring
      • Find the distinct words from a text file
      • DFS and BFS on trees, with and without recurssion
      • Remove duplicates from the sorted array
      • print all word combinations from phone number
      • String matching
      • Sorting binary array - Array containing only 0 and...
      • Write a C Program to reverse a stack "in place" us...
      • You are given a datatype, say X in C. The requirem...
      • What can be maximum memory that a process can have...
      • What should be done when an exception occurs in th...
      • How do you know where the memory leaks when you ha...
      • WAP to find the number containing all the digits (...
      • wo teen women wali puzzle ka sol..
      • how to chk if a no. is integer or not.
      • print 1-100 no.swithout loop in c
      • Write a C program which when compiled and run, pri...
      • Find the nth Ugly Number
      • Given a string s1 and a string s2, write a snippe...
      • Reverse a linked list
      • Remove duplicates from a sorted linked list
      • Insert nodes into a linked list in a sorted fashion
      • Return the nth node from the end of a linked list
      • Binary search on a linked list
      • C program to free the nodes of a linked list
      • Copy of a linked list
      • Compare two linked lists
      • Middle of a linked list
      • Basic functions of link list - Add and print
      • Function to add node to double link list
      • Detecting a loop in a linked list
      • Examples of printf
      • Comparing floats
      • Solution - #104 Project Euler
    • ►  March (3)
    • ►  January (33)
  • ►  2009 (115)
    • ►  December (91)
    • ►  November (4)
    • ►  September (13)
    • ►  August (4)
    • ►  June (3)
  • ►  2008 (25)
    • ►  August (25)

Blogger news

”" Math Formula?

Blogroll

ADs

Blogger news

Monday, April 26, 2010

DFS and BFS on trees, with and without recurssion

April 26, 2010  Algorithms, Binary Search Tree / BST, Data Structure Templates, DS / Data Structures, kodeknight, traversal, tree  No comments

BFS (Breath First Search) with and without recurssion 

DFS with Recursion and without recursion


Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)
 
  • Labels

    2DArray (6) 2DSortedArray (3) 2Sum (3) AbstractDataType/ADT (6) Adjacency (1) AdjacencyList (1) Adobe (8) AlgorithmAnalysis (3) Algorithms (78) Amazon (22) Amortize (1) anagrams (7) angular (1) application (2) aptitude (5) AptitudeConcepts (2) ArithematicPuzzle (3) array (68) ArraySearch (9) AsymptoticUpperBound (1) average (1) avl (7) b-tree (1) backtracking (9) balanced trees (19) balls (2) bank-bazaar (1) beautiful codes (1) BFS (10) big data (1) Big Omega (1) binary array (4) binary search (10) Binary Search Tree / BST (59) Binary Tree / BT (19) binary-sort (1) Bit Vector (2) bitonic (1) bits (38) blog (1) boolean (2) bottom-up (1) brainteaser (142) Breadth-First Traversal (1) browserstack (1) bubble sort (4) Bucket Sort (1) c (34) c implementation (1) c# (1) cache (2) calloc (1) catalan (1) celebrity (2) check (3) chess (1) circular stack (1) cleaner code (4) cloud computing (1) coding (1) coding style (5) coin (2) Combination (1) common math functions (1) companies (3) compare (3) Comparison Sort (3) Complete Binary tree (1) compression (2) concatenate (1) concurrency (3) confused (1) connectivity (3) console input (1) const (1) const functions (2) constructors (2) contiguous (1) conversion (18) coordinate geometry (6) count (13) counting-sort (1) cpp (43) cpp vs java (2) cppimpl (2) CrackingTheCodingInterview (149) Cram it (1) cryptography (2) cTricks (2) cut (2) Data Structure (41) Data Structure Templates (4) data types (4) Database (9) date-time (1) db-design (3) declarations (1) define (4) delete (5) Depth-First Traversal (1) deque (2) destructor (1) DFS (6) differences (1) dijkshtra (1) Directed Graph (3) directi (3) distance (10) Distribution Sort (1) divide and conquer (12) DLL/Doubly Linked List (10) double link list (1) DS / Data Structures (34) DS Concepts (2) duplicate (25) dynamic allocation (8) dynamic arrays (1) Dynamic Programming / DP (48) encoding (3) endianness (1) enum (2) errors (1) exceptions (1) exit (1) expressions (1) external sort (1) fab.com (3) facebook (1) factor (1) factorization (5) fast pointer (3) fibonacci (1) File handling (6) fileIO (2) fileRead (2) files (1) flipkart (4) floating point values (1) formatting-needed (2) frequency (1) fun (1) functions (2) game (1) generic classes (2) geometric-search (3) gist (1) git (2) github (3) good practice (1) google (4) goto (2) Graph (22) graph-search (11) graphics (3) greater (1) greedy Algo (7) grep (1) hackerrank (1) hard (12) hashes (4) hashmap (1) hashtable (8) heap (10) hiding (1) histogram (1) identical (1) If statement (1) ImplementOperatorWithConditions (1) In-place sorting (1) incomplete (112) increasing-sequence (1) inmobi (4) inorder (12) inorder successor (3) Inorder traversal (6) Input (2) Input Output / IO (5) insertion-sort (5) integer (13) integer series (1) integer-array (4) integer-sort (6) intersection (4) interval (4) interview (24) Interview Question (15) interview-set (4) inversion (1) iterative (5) jabong (2) java (35) Java Arrays (1) java-code (8) K-Distance (3) k5kced (10) kadane (1) keyword (1) KMP algorithm (2) knapsack problem (2) kodeknight (1034) kth-largest (6) largest (6) LCA/Least Common Ancestor (2) LCS (1) leetcode (1) level-order-traversal (4) library functions (1) limited memory (9) Linear datastructure (1) link list (31) linkage (1) linked list (12) linux / unix (53) list (1) local-minima (1) logical questions (1) loop (4) Looping construct (1) Low Level (10) macro (1) malloc (1) map-reduce (2) master-method (4) match string (1) Mathematical (5) mathematics (3) maths (22) matrix (7) matrix-multiplication (2) max (15) maxima (2) maze (1) median (3) medium (1) memoization (2) memory leaks (1) memory management (6) merge (13) merge-sort (5) Microsoft (8) middle (1) min (15) min-heap (2) mincut (2) minima (2) minimum spanning tree / mst (1) minmax (5) mirror (1) Moderate (9) morgan-stanley (3) multiplication (1) networking (13) next-big-number (2) non-linear datastructure (1) non-linear datastrucutre (1) number (2) number theory (2) number theoryQ (1) O(1) (2) Object oriented programming / OOP (1) object-oriented-design / OOD (14) Omega Time complexity (2) Operating System / OS (8) operations (2) operators (6) optimization (1) overflow (1) overloading (1) overriding (1) Page (21) pair (1) palindrome (6) parentheses (3) parse (1) partition (1) pascal (1) path (1) pathological data (1) pattern matching (7) Permutation (4) Permutation and Combination (4) plane (1) pointers (14) polymorphism (1) polynomial (1) postorder (5) Postorder traversal (2) powerOf2 (3) Predefined Values in headers (1) preorder (4) Preorder traversal (2) preprocessor (5) prime (9) prime-factor (5) PriorityQueue (3) probability (8) process (2) product (2) programCPP (9) programming (19) programming language / PL (1) programming Questions (4) programs (3) progression (1) projecteuler (2) psychometry test (1) Puzzles (29) pythagorean triplet (1) queen (1) queue (11) quicksort (7) quiz (1) radix-sort (1) random (4) randomized algorithm (3) range (2) ranged-array (8) rbt / red black tree (6) rectangle (6) recursion (35) references (3) regular expression (1) Relational Database (1) Remember (1) remove-duplicates (5) replace (1) Resources (2) reverse (12) rotated array (6) scanf (1) scoping (1) search (18) search string (1) second-largest (1) selection (4) Selection Sort (3) selection-sort (1) sequence (2) Sequential statement (1) series (2) shell-sort (1) shortest-path (4) shuffle (2) Single Link List (32) size (1) skip-list (3) smallest (4) snapdeal (1) Software Engg (6) sorted-array (17) sorted-list (1) sorting (50) Sorting Algorithm (4) sorting arrays (3) sorting-and-searching (7) spaces (2) spanning tree (1) Special Nos. (5) square matrix (1) squares (1) stack (33) STL (2) stock (3) stream (1) String (58) string-search (4) string-udf (5) StringAlgo (7) sub-array (2) subsequence (7) subset (3) substring (7) suffix tree (1) sum (3) swap (5) sweep-line (1) System Design And Memory Limits (7) templates (1) Testing (6) text editors (1) theory (3) thread (1) Threaded binary Tree (1) Threads and Locks (9) time (2) time complexity (14) toc2 (1) top-down (1) traversal (14) tree (57) trie (10) twin-prime (1) two-arrays (6) two-lists (1) two-sorted-arrays (7) two-string (2) udf (4) ugly-number (1) UML (1) understand (12) Undirected Graph (2) union (2) union-find (1) unique (5) unsorted-array (8) useful linux commands (17) UX (1) variable argument functions (1) variables (1) vdopia (1) vectors_cpp (1) verbal (2) vi editor (1) virtual function (1) virtualization (4) vmware (2) vocab (1) web (1) window (3) xml (1) xor (1) yahoo (3) zero (5) zigzag (1)
  • Likeus

    Powered by alltechmedia - FB Like Box Popup Widget
Copyright © KodeKnight | Powered by Blogger
Design by NewWpThemes | Blogger Theme by Lasantha - Free Blogger Themes
NewBloggerThemes.com