Tags » Linked List

Hackerrank : Print in Reverse

/*
*  Path :  All Domains > Data Structures > Linked Lists 
*  Code  By : Pritish Thakkar
*  Tags : Recursion , Linked List , Std(in/out)
*/

/*
  Print elements of a linked list in reverse order as standard output
  head pointer could be NULL as well for empty list
  Node is defined as 
  struct Node
  {
     int data;
     struct Node *next;
  }
*/
void ReversePrint(Node *head)
{
  // This is a "method-only" submission. 37 more words
Data Structures

Hackerrank : Insert a node at a specific position in a linked list

/*
*  Path :  All Domains > Data Structures > Linked Lists 
*  Code  By : Pritish Thakkar
*/

/*
  Insert Node at a given position in a linked list 
  head can be NULL 
  First element in the linked list is at position 0
  Node is defined as 
  struct Node
  {
     int data;
     struct Node *next;
  }
*/
Node* InsertNth(Node *head, int data, int position)
{
  // Complete this method only
  // Do not write main function. 40 more words
Data Structures

Hackerrank : Insert a node at the head of a linked list

/*
  Insert Node at the begining of a linked list
  Initially head pointer argument could be NULL for empty list
  Node is defined as 
  struct Node
  {
     int data;
     struct Node *next;
  }
return back the pointer to the head of the linked list in the below method. 52 more words
Data Structures

Hackerrank : Insert a Node at the Tail of a Linked List

/*
  Insert Node at the end of a linked list 
  head pointer input could be NULL as well for empty list
  Node is defined as 
  struct Node
  {
     int data;
     struct Node *next;
  }
*/
Node* Insert(Node *head,int data)
{
  // Complete this method
    Node *temp = head;
    // Using malloc :
    //struct Node *val = (struct Node*)malloc(sizeof(struct Node));
    Node *val = new Node();
    val->data = data;
    val->next = NULL;
    if(head == NULL){
        head = val;
        return head;
    }
    while(temp->next!=NULL){
        if(temp->next==NULL) break;
        temp=temp->next;
    }
    temp->next=val;
    return head;
}
Data Structures

JAVA :: COLLECTIONS

Hello people !
Are you INTERESTED in LEARNING JAVA with ILLUSTRATIVE examples !
I’ve created a page ->> JAVA : Collection framework !
From this page you get to know about various data collection classes in JAVA : 43 more words

Data Structures

Odd Even Linked List

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. 146 more words

Algo & Code (leetcode / C++)

Google - Design Phone Book


设计数据结构存电话号码。要求实现

isTaken(String phone)
takeNumber(String phone)
giveMeANumber() 642 more words

面经