SlideShare a Scribd company logo
//Let n = size of the hash table
// hashTable = array of size n, which represents the hash table
// hashIndex = represents the index of array
// If the list is EMPTY, we add the element into the list
/*If the list is NOT EMPTY then we compare the newNode to the node already in the list in such
a way to get sorted.*/
struct node
{
int key;
T value;
struct node *next;
};
struct node *hashTable[n] = {NULL};
struct node * createNode(int key, char *name, int age)
{
struct node *newnode;
newnode = (struct node *)malloc(sizeof(struct node));
newnode->key = key;
newnode->value = value;
newnode->next = NULL;
return newnode;
}
add(int key, T value)
{
int hashIndex = key % n;
struct node *newNode = creteNode(key,value);
/*Adding new node to the list with No element */
if (hashTable[hashIndex] == NULL)
{
hashTable[hashIndex] = newnode;
return;
}
/*Adding new node to the sorted list */
struct node *temp1;
struct node *temp2 = hashTable[hashIndex];
temp1 = temp2;
while(temp2 -> key < newNode -> key)
{
temp1 = temp2;
temp2 = temp2 ->next;
}
newnode->next = temp2;
temp1->next = newNode;
return;
}
Solution
//Let n = size of the hash table
// hashTable = array of size n, which represents the hash table
// hashIndex = represents the index of array
// If the list is EMPTY, we add the element into the list
/*If the list is NOT EMPTY then we compare the newNode to the node already in the list in such
a way to get sorted.*/
struct node
{
int key;
T value;
struct node *next;
};
struct node *hashTable[n] = {NULL};
struct node * createNode(int key, char *name, int age)
{
struct node *newnode;
newnode = (struct node *)malloc(sizeof(struct node));
newnode->key = key;
newnode->value = value;
newnode->next = NULL;
return newnode;
}
add(int key, T value)
{
int hashIndex = key % n;
struct node *newNode = creteNode(key,value);
/*Adding new node to the list with No element */
if (hashTable[hashIndex] == NULL)
{
hashTable[hashIndex] = newnode;
return;
}
/*Adding new node to the sorted list */
struct node *temp1;
struct node *temp2 = hashTable[hashIndex];
temp1 = temp2;
while(temp2 -> key < newNode -> key)
{
temp1 = temp2;
temp2 = temp2 ->next;
}
newnode->next = temp2;
temp1->next = newNode;
return;
}
Ad

More Related Content

Similar to Let n = size of the hash table hashTable = array of size n, w.pdf (20)

linked-list.ppt
linked-list.pptlinked-list.ppt
linked-list.ppt
DikkySuryadiSKomMKom
 
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdfTHE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
fathimahardwareelect
 
week-13x
week-13xweek-13x
week-13x
KITE www.kitecolleges.com
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
Masud Parvaze
 
C Homework Help
C Homework HelpC Homework Help
C Homework Help
Programming Homework Help
 
Describe a data structure to represent sets of elements (each element.pdf
Describe a data structure to represent sets of elements (each element.pdfDescribe a data structure to represent sets of elements (each element.pdf
Describe a data structure to represent sets of elements (each element.pdf
rajeshjain2109
 
17 linkedlist (1)
17 linkedlist (1)17 linkedlist (1)
17 linkedlist (1)
Himadri Sen Gupta
 
This will need to be in a header file called LinkedList.hInser.pdf
This will need to be in a header file called LinkedList.hInser.pdfThis will need to be in a header file called LinkedList.hInser.pdf
This will need to be in a header file called LinkedList.hInser.pdf
cleanhome88
 
In this assignment you will implement insert() method for a singly l.pdf
In this assignment you will implement insert() method for a singly l.pdfIn this assignment you will implement insert() method for a singly l.pdf
In this assignment you will implement insert() method for a singly l.pdf
fantasiatheoutofthef
 
in C++ , Design a linked list class named IntegerList to hold a seri.pdf
in C++ , Design a linked list class named IntegerList to hold a seri.pdfin C++ , Design a linked list class named IntegerList to hold a seri.pdf
in C++ , Design a linked list class named IntegerList to hold a seri.pdf
eyewaregallery
 
I have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdfI have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdf
arkmuzikllc
 
C Exam Help
C Exam Help C Exam Help
C Exam Help
Programming Exam Help
 
Program to insert in a sorted list #includestdio.h#include.pdf
 Program to insert in a sorted list #includestdio.h#include.pdf Program to insert in a sorted list #includestdio.h#include.pdf
Program to insert in a sorted list #includestdio.h#include.pdf
sudhirchourasia86
 
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdfWrite the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
fathimalinks
 
3.linked list
3.linked list3.linked list
3.linked list
Chandan Singh
 
could you implement this function please, im having issues with it..pdf
could you implement this function please, im having issues with it..pdfcould you implement this function please, im having issues with it..pdf
could you implement this function please, im having issues with it..pdf
feroz544
 
The hashtable youll be making will use Strings as the keys and Obje.pdf
The hashtable youll be making will use Strings as the keys and Obje.pdfThe hashtable youll be making will use Strings as the keys and Obje.pdf
The hashtable youll be making will use Strings as the keys and Obje.pdf
vicky309441
 
please help me in C++Objective Create a singly linked list of num.pdf
please help me in C++Objective Create a singly linked list of num.pdfplease help me in C++Objective Create a singly linked list of num.pdf
please help me in C++Objective Create a singly linked list of num.pdf
aminbijal86
 
#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docx#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docx
ajoy21
 
Unit7 C
Unit7 CUnit7 C
Unit7 C
arnold 7490
 
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdfTHE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
fathimahardwareelect
 
Describe a data structure to represent sets of elements (each element.pdf
Describe a data structure to represent sets of elements (each element.pdfDescribe a data structure to represent sets of elements (each element.pdf
Describe a data structure to represent sets of elements (each element.pdf
rajeshjain2109
 
This will need to be in a header file called LinkedList.hInser.pdf
This will need to be in a header file called LinkedList.hInser.pdfThis will need to be in a header file called LinkedList.hInser.pdf
This will need to be in a header file called LinkedList.hInser.pdf
cleanhome88
 
In this assignment you will implement insert() method for a singly l.pdf
In this assignment you will implement insert() method for a singly l.pdfIn this assignment you will implement insert() method for a singly l.pdf
In this assignment you will implement insert() method for a singly l.pdf
fantasiatheoutofthef
 
in C++ , Design a linked list class named IntegerList to hold a seri.pdf
in C++ , Design a linked list class named IntegerList to hold a seri.pdfin C++ , Design a linked list class named IntegerList to hold a seri.pdf
in C++ , Design a linked list class named IntegerList to hold a seri.pdf
eyewaregallery
 
I have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdfI have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdf
arkmuzikllc
 
Program to insert in a sorted list #includestdio.h#include.pdf
 Program to insert in a sorted list #includestdio.h#include.pdf Program to insert in a sorted list #includestdio.h#include.pdf
Program to insert in a sorted list #includestdio.h#include.pdf
sudhirchourasia86
 
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdfWrite the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
fathimalinks
 
could you implement this function please, im having issues with it..pdf
could you implement this function please, im having issues with it..pdfcould you implement this function please, im having issues with it..pdf
could you implement this function please, im having issues with it..pdf
feroz544
 
The hashtable youll be making will use Strings as the keys and Obje.pdf
The hashtable youll be making will use Strings as the keys and Obje.pdfThe hashtable youll be making will use Strings as the keys and Obje.pdf
The hashtable youll be making will use Strings as the keys and Obje.pdf
vicky309441
 
please help me in C++Objective Create a singly linked list of num.pdf
please help me in C++Objective Create a singly linked list of num.pdfplease help me in C++Objective Create a singly linked list of num.pdf
please help me in C++Objective Create a singly linked list of num.pdf
aminbijal86
 
#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docx#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docx
ajoy21
 

More from aravlitraders2012 (20)

Exception to indicate that Singly LinkedList is empty. .pdf
  Exception to indicate that Singly LinkedList is empty. .pdf  Exception to indicate that Singly LinkedList is empty. .pdf
Exception to indicate that Singly LinkedList is empty. .pdf
aravlitraders2012
 
Electronegativity - Electronegativity is an atom.pdf
                     Electronegativity - Electronegativity is an atom.pdf                     Electronegativity - Electronegativity is an atom.pdf
Electronegativity - Electronegativity is an atom.pdf
aravlitraders2012
 
Sequence.h#ifndef MAIN #define MAIN #include cstdlibclass .pdf
Sequence.h#ifndef MAIN #define MAIN #include cstdlibclass .pdfSequence.h#ifndef MAIN #define MAIN #include cstdlibclass .pdf
Sequence.h#ifndef MAIN #define MAIN #include cstdlibclass .pdf
aravlitraders2012
 
In the 1st Question, As the polymorphisms occur in the non-coding se.pdf
  In the 1st Question, As the polymorphisms occur in the non-coding se.pdf  In the 1st Question, As the polymorphisms occur in the non-coding se.pdf
In the 1st Question, As the polymorphisms occur in the non-coding se.pdf
aravlitraders2012
 
I noticed that temperature is not mentioned. A) .pdf
                     I noticed that temperature is not mentioned.  A) .pdf                     I noticed that temperature is not mentioned.  A) .pdf
I noticed that temperature is not mentioned. A) .pdf
aravlitraders2012
 
1. Briefly describe the structured design approach and the object-or.pdf
1. Briefly describe the structured design approach and the object-or.pdf1. Briefly describe the structured design approach and the object-or.pdf
1. Briefly describe the structured design approach and the object-or.pdf
aravlitraders2012
 
1) Protocols are needed so your computer can interact with other com.pdf
1) Protocols are needed so your computer can interact with other com.pdf1) Protocols are needed so your computer can interact with other com.pdf
1) Protocols are needed so your computer can interact with other com.pdf
aravlitraders2012
 
argon is inert gas , doesnot chemically reacts wi.pdf
                     argon is inert gas , doesnot chemically reacts wi.pdf                     argon is inert gas , doesnot chemically reacts wi.pdf
argon is inert gas , doesnot chemically reacts wi.pdf
aravlitraders2012
 
#include sstream #include linkylist.h #include iostream.pdf
#include sstream #include linkylist.h #include iostream.pdf#include sstream #include linkylist.h #include iostream.pdf
#include sstream #include linkylist.h #include iostream.pdf
aravlitraders2012
 
Function header If a program contain a function definition, that .pdf
Function header If a program contain a function definition, that .pdfFunction header If a program contain a function definition, that .pdf
Function header If a program contain a function definition, that .pdf
aravlitraders2012
 
GameOfLife.cs using System; using System.Collections.Generic;.pdf
GameOfLife.cs using System; using System.Collections.Generic;.pdfGameOfLife.cs using System; using System.Collections.Generic;.pdf
GameOfLife.cs using System; using System.Collections.Generic;.pdf
aravlitraders2012
 
With the vast increase in technology, the number of ways that the us.pdf
With the vast increase in technology, the number of ways that the us.pdfWith the vast increase in technology, the number of ways that the us.pdf
With the vast increase in technology, the number of ways that the us.pdf
aravlitraders2012
 
What is the need of the t Distribution According to the central.pdf
What is the need of the t Distribution According to the central.pdfWhat is the need of the t Distribution According to the central.pdf
What is the need of the t Distribution According to the central.pdf
aravlitraders2012
 
We can see in course of evolution of plant there was a transition fr.pdf
We can see in course of evolution of plant there was a transition fr.pdfWe can see in course of evolution of plant there was a transition fr.pdf
We can see in course of evolution of plant there was a transition fr.pdf
aravlitraders2012
 
Wave CharacterMany of the things that light does are only expla.pdf
 Wave CharacterMany of the things that light does are only expla.pdf Wave CharacterMany of the things that light does are only expla.pdf
Wave CharacterMany of the things that light does are only expla.pdf
aravlitraders2012
 
The solvent doesnt interfere with the purification processOil Bath.pdf
The solvent doesnt interfere with the purification processOil Bath.pdfThe solvent doesnt interfere with the purification processOil Bath.pdf
The solvent doesnt interfere with the purification processOil Bath.pdf
aravlitraders2012
 
An object of class StatCalc can be used to compute several simp.pdf
 An object of class StatCalc can be used to compute several simp.pdf An object of class StatCalc can be used to compute several simp.pdf
An object of class StatCalc can be used to compute several simp.pdf
aravlitraders2012
 
The answers can be found below as discussedPart 1)The human gen.pdf
The answers can be found below as discussedPart 1)The human gen.pdfThe answers can be found below as discussedPart 1)The human gen.pdf
The answers can be found below as discussedPart 1)The human gen.pdf
aravlitraders2012
 
Solution (3)The smallest respiratory bronchioles subdivide into t.pdf
Solution (3)The smallest respiratory bronchioles subdivide into t.pdfSolution (3)The smallest respiratory bronchioles subdivide into t.pdf
Solution (3)The smallest respiratory bronchioles subdivide into t.pdf
aravlitraders2012
 
An asset manager of a hedge fund or a mutual funds is the one who di.pdf
An asset manager of a hedge fund or a mutual funds is the one who di.pdfAn asset manager of a hedge fund or a mutual funds is the one who di.pdf
An asset manager of a hedge fund or a mutual funds is the one who di.pdf
aravlitraders2012
 
Exception to indicate that Singly LinkedList is empty. .pdf
  Exception to indicate that Singly LinkedList is empty. .pdf  Exception to indicate that Singly LinkedList is empty. .pdf
Exception to indicate that Singly LinkedList is empty. .pdf
aravlitraders2012
 
Electronegativity - Electronegativity is an atom.pdf
                     Electronegativity - Electronegativity is an atom.pdf                     Electronegativity - Electronegativity is an atom.pdf
Electronegativity - Electronegativity is an atom.pdf
aravlitraders2012
 
Sequence.h#ifndef MAIN #define MAIN #include cstdlibclass .pdf
Sequence.h#ifndef MAIN #define MAIN #include cstdlibclass .pdfSequence.h#ifndef MAIN #define MAIN #include cstdlibclass .pdf
Sequence.h#ifndef MAIN #define MAIN #include cstdlibclass .pdf
aravlitraders2012
 
In the 1st Question, As the polymorphisms occur in the non-coding se.pdf
  In the 1st Question, As the polymorphisms occur in the non-coding se.pdf  In the 1st Question, As the polymorphisms occur in the non-coding se.pdf
In the 1st Question, As the polymorphisms occur in the non-coding se.pdf
aravlitraders2012
 
I noticed that temperature is not mentioned. A) .pdf
                     I noticed that temperature is not mentioned.  A) .pdf                     I noticed that temperature is not mentioned.  A) .pdf
I noticed that temperature is not mentioned. A) .pdf
aravlitraders2012
 
1. Briefly describe the structured design approach and the object-or.pdf
1. Briefly describe the structured design approach and the object-or.pdf1. Briefly describe the structured design approach and the object-or.pdf
1. Briefly describe the structured design approach and the object-or.pdf
aravlitraders2012
 
1) Protocols are needed so your computer can interact with other com.pdf
1) Protocols are needed so your computer can interact with other com.pdf1) Protocols are needed so your computer can interact with other com.pdf
1) Protocols are needed so your computer can interact with other com.pdf
aravlitraders2012
 
argon is inert gas , doesnot chemically reacts wi.pdf
                     argon is inert gas , doesnot chemically reacts wi.pdf                     argon is inert gas , doesnot chemically reacts wi.pdf
argon is inert gas , doesnot chemically reacts wi.pdf
aravlitraders2012
 
#include sstream #include linkylist.h #include iostream.pdf
#include sstream #include linkylist.h #include iostream.pdf#include sstream #include linkylist.h #include iostream.pdf
#include sstream #include linkylist.h #include iostream.pdf
aravlitraders2012
 
Function header If a program contain a function definition, that .pdf
Function header If a program contain a function definition, that .pdfFunction header If a program contain a function definition, that .pdf
Function header If a program contain a function definition, that .pdf
aravlitraders2012
 
GameOfLife.cs using System; using System.Collections.Generic;.pdf
GameOfLife.cs using System; using System.Collections.Generic;.pdfGameOfLife.cs using System; using System.Collections.Generic;.pdf
GameOfLife.cs using System; using System.Collections.Generic;.pdf
aravlitraders2012
 
With the vast increase in technology, the number of ways that the us.pdf
With the vast increase in technology, the number of ways that the us.pdfWith the vast increase in technology, the number of ways that the us.pdf
With the vast increase in technology, the number of ways that the us.pdf
aravlitraders2012
 
What is the need of the t Distribution According to the central.pdf
What is the need of the t Distribution According to the central.pdfWhat is the need of the t Distribution According to the central.pdf
What is the need of the t Distribution According to the central.pdf
aravlitraders2012
 
We can see in course of evolution of plant there was a transition fr.pdf
We can see in course of evolution of plant there was a transition fr.pdfWe can see in course of evolution of plant there was a transition fr.pdf
We can see in course of evolution of plant there was a transition fr.pdf
aravlitraders2012
 
Wave CharacterMany of the things that light does are only expla.pdf
 Wave CharacterMany of the things that light does are only expla.pdf Wave CharacterMany of the things that light does are only expla.pdf
Wave CharacterMany of the things that light does are only expla.pdf
aravlitraders2012
 
The solvent doesnt interfere with the purification processOil Bath.pdf
The solvent doesnt interfere with the purification processOil Bath.pdfThe solvent doesnt interfere with the purification processOil Bath.pdf
The solvent doesnt interfere with the purification processOil Bath.pdf
aravlitraders2012
 
An object of class StatCalc can be used to compute several simp.pdf
 An object of class StatCalc can be used to compute several simp.pdf An object of class StatCalc can be used to compute several simp.pdf
An object of class StatCalc can be used to compute several simp.pdf
aravlitraders2012
 
The answers can be found below as discussedPart 1)The human gen.pdf
The answers can be found below as discussedPart 1)The human gen.pdfThe answers can be found below as discussedPart 1)The human gen.pdf
The answers can be found below as discussedPart 1)The human gen.pdf
aravlitraders2012
 
Solution (3)The smallest respiratory bronchioles subdivide into t.pdf
Solution (3)The smallest respiratory bronchioles subdivide into t.pdfSolution (3)The smallest respiratory bronchioles subdivide into t.pdf
Solution (3)The smallest respiratory bronchioles subdivide into t.pdf
aravlitraders2012
 
An asset manager of a hedge fund or a mutual funds is the one who di.pdf
An asset manager of a hedge fund or a mutual funds is the one who di.pdfAn asset manager of a hedge fund or a mutual funds is the one who di.pdf
An asset manager of a hedge fund or a mutual funds is the one who di.pdf
aravlitraders2012
 
Ad

Recently uploaded (20)

How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptxLecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Arshad Shaikh
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Rococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th centuryRococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th century
Gema
 
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdfRanking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Rafael Villas B
 
Herbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptxHerbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptx
RAJU THENGE
 
Cultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptxCultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptx
UmeshTimilsina1
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
 
Tax evasion, Tax planning & Tax avoidance.pptx
Tax evasion, Tax  planning &  Tax avoidance.pptxTax evasion, Tax  planning &  Tax avoidance.pptx
Tax evasion, Tax planning & Tax avoidance.pptx
manishbaidya2017
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptxLecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Arshad Shaikh
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Rococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th centuryRococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th century
Gema
 
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdfRanking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Rafael Villas B
 
Herbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptxHerbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptx
RAJU THENGE
 
Cultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptxCultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptx
UmeshTimilsina1
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
 
Tax evasion, Tax planning & Tax avoidance.pptx
Tax evasion, Tax  planning &  Tax avoidance.pptxTax evasion, Tax  planning &  Tax avoidance.pptx
Tax evasion, Tax planning & Tax avoidance.pptx
manishbaidya2017
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Ad

Let n = size of the hash table hashTable = array of size n, w.pdf

  • 1. //Let n = size of the hash table // hashTable = array of size n, which represents the hash table // hashIndex = represents the index of array // If the list is EMPTY, we add the element into the list /*If the list is NOT EMPTY then we compare the newNode to the node already in the list in such a way to get sorted.*/ struct node { int key; T value; struct node *next; }; struct node *hashTable[n] = {NULL}; struct node * createNode(int key, char *name, int age) { struct node *newnode; newnode = (struct node *)malloc(sizeof(struct node)); newnode->key = key; newnode->value = value; newnode->next = NULL; return newnode; } add(int key, T value) { int hashIndex = key % n; struct node *newNode = creteNode(key,value); /*Adding new node to the list with No element */ if (hashTable[hashIndex] == NULL) { hashTable[hashIndex] = newnode; return;
  • 2. } /*Adding new node to the sorted list */ struct node *temp1; struct node *temp2 = hashTable[hashIndex]; temp1 = temp2; while(temp2 -> key < newNode -> key) { temp1 = temp2; temp2 = temp2 ->next; } newnode->next = temp2; temp1->next = newNode; return; } Solution //Let n = size of the hash table // hashTable = array of size n, which represents the hash table // hashIndex = represents the index of array // If the list is EMPTY, we add the element into the list /*If the list is NOT EMPTY then we compare the newNode to the node already in the list in such a way to get sorted.*/ struct node { int key; T value; struct node *next; }; struct node *hashTable[n] = {NULL}; struct node * createNode(int key, char *name, int age) { struct node *newnode;
  • 3. newnode = (struct node *)malloc(sizeof(struct node)); newnode->key = key; newnode->value = value; newnode->next = NULL; return newnode; } add(int key, T value) { int hashIndex = key % n; struct node *newNode = creteNode(key,value); /*Adding new node to the list with No element */ if (hashTable[hashIndex] == NULL) { hashTable[hashIndex] = newnode; return; } /*Adding new node to the sorted list */ struct node *temp1; struct node *temp2 = hashTable[hashIndex]; temp1 = temp2; while(temp2 -> key < newNode -> key) { temp1 = temp2; temp2 = temp2 ->next; } newnode->next = temp2; temp1->next = newNode; return; }