In computer science, tree traversal (also known as tree search) is a form of graph traversal and refers to the process of visiting (checking and/or updating) each node in a tree data structure, exactly once.Here we are talking about Pre-order tree traversal, and we will also learn a problem of hackerrank related to it.

Home » Data Structure

# Category: Data Structure

→

Data structure is a blue print or design for storing/modifying related data.

there are many type of DS

Linked List

Array

Tree

Stack

Queue

Queue using Two Stacks Hackerrank A queue is an abstract data type that maintains the order in which elements were added to it, allowing the oldest elements to be removed from the front and new elements to be added to the rear. This is called a First-In-First-Out (FIFO) data structure because the first element added to the queue (i.e., the one that has been waiting the longest) is always the first one to be removed. A basic queue has the …

Arrays – DS Hackerrank An array is a type of data structure that stores elements of the same type in a contiguous block of memory. In an array, A, of size N, each memory location has some unique index, i (where 0<=i<=N), that can be referenced as A[i] (you may also see it written as Ai). Given an array, …

Is This a Binary Search Tree? Hackerrank For the purposes of this challenge, we define a binary search tree to be a binary tree with the following ordering requirements: The data value of every node in a node’s left subtree is less than the data value of that node. The data value of every node in a node’s right subtree is greater than the data value of that node. Given the root node of a binary tree, can you determine …

BFS i.e Breadth First Search is very well known algorithm for traversing the graph or tree.

Reverse a doubly linked list Hackerrank You’re given the pointer to the head node of a doubly linked list. Reverse the order of the nodes in the list. The head node might be NULL to indicate that the list is empty. Input Format You have to complete the Node* Reverse(Node* head) method which takes one argument – the head of the doubly linked list. You should NOT read any input from stdin/console. Output Format Change the next and prev pointers …

We all know that Graph is very important part to be learn if you are a CS/IT student.So here we are to explain the concept of Graph Theory.Let's have a look at it.Getting started with the definition of Graph Theory as "A graph is a pictorial representation of a set of objects where some pairs of objects are connected by links...."