SlideShare a Scribd company logo
Using the provided table interface table.h and the sample linked list code linkedList.c, complete
an implementation of the Table ADT. Make sure that you apply the concepts of design by
contract (DbC) to your implementation.
Once you have fully implemented the table, create a main.c file that implements a testing
framework for your table.
Your table implementation must ensure that values inserted are unique, and internally sorted
within a linked list.
table.h
linkedList.c
Solution
khsdg
#include
#include
typedef enum BOOL { false, true } bool;
// Linked list node definition
typedef struct Node node;
struct Node
{
int number;
node *next;
};
static node *top = NULL;
// used to track where we are for the list traversal methods
static node *traverseNode = NULL;
// "destroy" will deallocate all nodes in a linked list object
// and will set "top" to NULL.
void destroy()
{
node *curr = top;
node *temp = NULL;
while ( curr != NULL )
{
// flip order to see it blow up...
temp = curr;
curr = curr->next;
free( temp );
}
top = NULL;
}
// "build" will create an ordered linked list consisting
// of the first "size" even integers.
void build( int size )
{
node *newNode = NULL;
int i = 0;
// make sure we don't have a list yet
destroy();
for ( i=size ; i>0 ; i-- )
{
newNode = malloc( sizeof( node ) );
newNode->number = i*2;
newNode->next = top;
top = newNode;
}
}
// starts a list traversal by getting the data at top.
// returns false if top == NULL.
bool firstNode( int *item )
{
bool result = false;
if ( top )
{
*item = top->number;
traverseNode = top->next;
result = true;
}
return result;
}
// gets the data at the current traversal node and increments the traversal.
// returns false if we're at the end of the list.
bool nextNode( int *item )
{
bool result = false;
if ( traverseNode )
{
*item = traverseNode->number;
traverseNode = traverseNode->next;
result = true;
}
return result;
}
// "print" will output an object's entire linked list
// to the standard output device -- one "number" per line.
void print()
{
int value;
if ( firstNode( &value ) )
{
do
{
printf( "%d ", value );
} while ( nextNode( &value ) );
}
}
int main( int argc, char *argv[] )
{
build( 10 );
print();
destroy();
build( 5 );
build( 20 );
print();
destroy();
return 0;
}

More Related Content

Similar to Using the provided table interface table.h and the sample linked lis.pdf

C Homework Help
C Homework HelpC Homework Help
C Homework Help
Programming Homework Help
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
feelinggift
 
A)B) C++ program to create a Complete Binary tree from its Lin.pdf
A)B) C++ program to create a Complete Binary tree from its Lin.pdfA)B) C++ program to create a Complete Binary tree from its Lin.pdf
A)B) C++ program to create a Complete Binary tree from its Lin.pdf
anton291
 
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
 
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfInspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
vishalateen
 
C program to insert a node in doubly linked list
C program to insert a node in doubly linked listC program to insert a node in doubly linked list
C program to insert a node in doubly linked list
Sourav Gayen
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
fortmdu
 
Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdf
JUSTSTYLISH3B2MOHALI
 
Data Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdfData Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdf
rohit219406
 
C++Write a method Node Nodereverse() which reverses a list..pdf
C++Write a method Node Nodereverse() which reverses a list..pdfC++Write a method Node Nodereverse() which reverses a list..pdf
C++Write a method Node Nodereverse() which reverses a list..pdf
arjunenterprises1978
 
There are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docxThere are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docx
clarkjanyce
 
take the following code and give details of what each line of code i.pdf
take the following code and give details of what each line of code i.pdftake the following code and give details of what each line of code i.pdf
take the following code and give details of what each line of code i.pdf
fastechsrv
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
Masud Parvaze
 
Data Structures and Agorithm: DS 05 Doubly Linked List.pptx
Data Structures and Agorithm: DS 05 Doubly Linked List.pptxData Structures and Agorithm: DS 05 Doubly Linked List.pptx
Data Structures and Agorithm: DS 05 Doubly Linked List.pptx
RashidFaridChishti
 
#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf
KUNALHARCHANDANI1
 
Linked lists
Linked listsLinked lists
Linked lists
George Scott IV
 
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfAnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
anwarsadath111
 
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdfPROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
climatecontrolsv
 
In the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdfIn the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdf
arjunstores123
 
Note             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdfNote             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdf
Ankitchhabra28
 

Similar to Using the provided table interface table.h and the sample linked lis.pdf (20)

C Homework Help
C Homework HelpC Homework Help
C Homework Help
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
 
A)B) C++ program to create a Complete Binary tree from its Lin.pdf
A)B) C++ program to create a Complete Binary tree from its Lin.pdfA)B) C++ program to create a Complete Binary tree from its Lin.pdf
A)B) C++ program to create a Complete Binary tree from its Lin.pdf
 
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
 
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfInspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
 
C program to insert a node in doubly linked list
C program to insert a node in doubly linked listC program to insert a node in doubly linked list
C program to insert a node in doubly linked list
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
 
Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdf
 
Data Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdfData Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdf
 
C++Write a method Node Nodereverse() which reverses a list..pdf
C++Write a method Node Nodereverse() which reverses a list..pdfC++Write a method Node Nodereverse() which reverses a list..pdf
C++Write a method Node Nodereverse() which reverses a list..pdf
 
There are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docxThere are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docx
 
take the following code and give details of what each line of code i.pdf
take the following code and give details of what each line of code i.pdftake the following code and give details of what each line of code i.pdf
take the following code and give details of what each line of code i.pdf
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
 
Data Structures and Agorithm: DS 05 Doubly Linked List.pptx
Data Structures and Agorithm: DS 05 Doubly Linked List.pptxData Structures and Agorithm: DS 05 Doubly Linked List.pptx
Data Structures and Agorithm: DS 05 Doubly Linked List.pptx
 
#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf
 
Linked lists
Linked listsLinked lists
Linked lists
 
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfAnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
 
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdfPROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
 
In the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdfIn the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdf
 
Note             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdfNote             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdf
 

More from connellalykshamesb60

JAVA ProgrammingDesign a class Message that models an e-mail messa.pdf
JAVA ProgrammingDesign a class Message that models an e-mail messa.pdfJAVA ProgrammingDesign a class Message that models an e-mail messa.pdf
JAVA ProgrammingDesign a class Message that models an e-mail messa.pdf
connellalykshamesb60
 
In which of the following structures are spores formed (Select all .pdf
In which of the following structures are spores formed (Select all .pdfIn which of the following structures are spores formed (Select all .pdf
In which of the following structures are spores formed (Select all .pdf
connellalykshamesb60
 
How does Windows managestore user names and passwords How does it .pdf
How does Windows managestore user names and passwords How does it .pdfHow does Windows managestore user names and passwords How does it .pdf
How does Windows managestore user names and passwords How does it .pdf
connellalykshamesb60
 
How to use class set a function(double money(); receive a number and .pdf
How to use class set a function(double money(); receive a number and .pdfHow to use class set a function(double money(); receive a number and .pdf
How to use class set a function(double money(); receive a number and .pdf
connellalykshamesb60
 
For each of the following descriptions indicate which best describes.pdf
For each of the following descriptions indicate which best describes.pdfFor each of the following descriptions indicate which best describes.pdf
For each of the following descriptions indicate which best describes.pdf
connellalykshamesb60
 
Explain how an Annelidian differs from a MolluscanSolutionMoll.pdf
Explain how an Annelidian differs from a MolluscanSolutionMoll.pdfExplain how an Annelidian differs from a MolluscanSolutionMoll.pdf
Explain how an Annelidian differs from a MolluscanSolutionMoll.pdf
connellalykshamesb60
 
DNA s composed of nucleotides that are joined together by covalent bo.pdf
DNA s composed of nucleotides that are joined together by covalent bo.pdfDNA s composed of nucleotides that are joined together by covalent bo.pdf
DNA s composed of nucleotides that are joined together by covalent bo.pdf
connellalykshamesb60
 
Discuss some of the challenges involved in ensuring that critical kn.pdf
Discuss some of the challenges involved in ensuring that critical kn.pdfDiscuss some of the challenges involved in ensuring that critical kn.pdf
Discuss some of the challenges involved in ensuring that critical kn.pdf
connellalykshamesb60
 
Biologically, the term is synonymous with [Choose the term race. refe.pdf
Biologically, the term is synonymous with [Choose the term race. refe.pdfBiologically, the term is synonymous with [Choose the term race. refe.pdf
Biologically, the term is synonymous with [Choose the term race. refe.pdf
connellalykshamesb60
 
Anyone good with linguistics Are the following headlines transitive.pdf
Anyone good with linguistics Are the following headlines transitive.pdfAnyone good with linguistics Are the following headlines transitive.pdf
Anyone good with linguistics Are the following headlines transitive.pdf
connellalykshamesb60
 
A mother and father both have normal karyotypes. The father is color .pdf
A mother and father both have normal karyotypes. The father is color .pdfA mother and father both have normal karyotypes. The father is color .pdf
A mother and father both have normal karyotypes. The father is color .pdf
connellalykshamesb60
 
A man has a condition where all of his gametes undergo nondisjunctio.pdf
A man has a condition where all of his gametes undergo nondisjunctio.pdfA man has a condition where all of his gametes undergo nondisjunctio.pdf
A man has a condition where all of his gametes undergo nondisjunctio.pdf
connellalykshamesb60
 
____ The pigment produced by S. marvel scenes would appear first on t.pdf
____ The pigment produced by S. marvel scenes would appear first on t.pdf____ The pigment produced by S. marvel scenes would appear first on t.pdf
____ The pigment produced by S. marvel scenes would appear first on t.pdf
connellalykshamesb60
 
Write the advantages of using JavaFX with compare to Swing and AWT..pdf
Write the advantages of using JavaFX with compare to Swing and AWT..pdfWrite the advantages of using JavaFX with compare to Swing and AWT..pdf
Write the advantages of using JavaFX with compare to Swing and AWT..pdf
connellalykshamesb60
 
Write a program in c++ that produces a bar chart showing the populat.pdf
Write a program in c++ that produces a bar chart showing the populat.pdfWrite a program in c++ that produces a bar chart showing the populat.pdf
Write a program in c++ that produces a bar chart showing the populat.pdf
connellalykshamesb60
 
Write a 2 page essay describing what life was like in the Great Depr.pdf
Write a 2 page essay describing what life was like in the Great Depr.pdfWrite a 2 page essay describing what life was like in the Great Depr.pdf
Write a 2 page essay describing what life was like in the Great Depr.pdf
connellalykshamesb60
 
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdfWhy do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
connellalykshamesb60
 
Why Computer System Management is so critical for the companies (50.pdf
Why Computer System Management is so critical for the companies (50.pdfWhy Computer System Management is so critical for the companies (50.pdf
Why Computer System Management is so critical for the companies (50.pdf
connellalykshamesb60
 
Which of the following statements is not true about facilitated diff.pdf
Which of the following statements is not true about facilitated diff.pdfWhich of the following statements is not true about facilitated diff.pdf
Which of the following statements is not true about facilitated diff.pdf
connellalykshamesb60
 
Which is not a hypothesis for the origin of virusesThey originated .pdf
Which is not a hypothesis for the origin of virusesThey originated .pdfWhich is not a hypothesis for the origin of virusesThey originated .pdf
Which is not a hypothesis for the origin of virusesThey originated .pdf
connellalykshamesb60
 

More from connellalykshamesb60 (20)

JAVA ProgrammingDesign a class Message that models an e-mail messa.pdf
JAVA ProgrammingDesign a class Message that models an e-mail messa.pdfJAVA ProgrammingDesign a class Message that models an e-mail messa.pdf
JAVA ProgrammingDesign a class Message that models an e-mail messa.pdf
 
In which of the following structures are spores formed (Select all .pdf
In which of the following structures are spores formed (Select all .pdfIn which of the following structures are spores formed (Select all .pdf
In which of the following structures are spores formed (Select all .pdf
 
How does Windows managestore user names and passwords How does it .pdf
How does Windows managestore user names and passwords How does it .pdfHow does Windows managestore user names and passwords How does it .pdf
How does Windows managestore user names and passwords How does it .pdf
 
How to use class set a function(double money(); receive a number and .pdf
How to use class set a function(double money(); receive a number and .pdfHow to use class set a function(double money(); receive a number and .pdf
How to use class set a function(double money(); receive a number and .pdf
 
For each of the following descriptions indicate which best describes.pdf
For each of the following descriptions indicate which best describes.pdfFor each of the following descriptions indicate which best describes.pdf
For each of the following descriptions indicate which best describes.pdf
 
Explain how an Annelidian differs from a MolluscanSolutionMoll.pdf
Explain how an Annelidian differs from a MolluscanSolutionMoll.pdfExplain how an Annelidian differs from a MolluscanSolutionMoll.pdf
Explain how an Annelidian differs from a MolluscanSolutionMoll.pdf
 
DNA s composed of nucleotides that are joined together by covalent bo.pdf
DNA s composed of nucleotides that are joined together by covalent bo.pdfDNA s composed of nucleotides that are joined together by covalent bo.pdf
DNA s composed of nucleotides that are joined together by covalent bo.pdf
 
Discuss some of the challenges involved in ensuring that critical kn.pdf
Discuss some of the challenges involved in ensuring that critical kn.pdfDiscuss some of the challenges involved in ensuring that critical kn.pdf
Discuss some of the challenges involved in ensuring that critical kn.pdf
 
Biologically, the term is synonymous with [Choose the term race. refe.pdf
Biologically, the term is synonymous with [Choose the term race. refe.pdfBiologically, the term is synonymous with [Choose the term race. refe.pdf
Biologically, the term is synonymous with [Choose the term race. refe.pdf
 
Anyone good with linguistics Are the following headlines transitive.pdf
Anyone good with linguistics Are the following headlines transitive.pdfAnyone good with linguistics Are the following headlines transitive.pdf
Anyone good with linguistics Are the following headlines transitive.pdf
 
A mother and father both have normal karyotypes. The father is color .pdf
A mother and father both have normal karyotypes. The father is color .pdfA mother and father both have normal karyotypes. The father is color .pdf
A mother and father both have normal karyotypes. The father is color .pdf
 
A man has a condition where all of his gametes undergo nondisjunctio.pdf
A man has a condition where all of his gametes undergo nondisjunctio.pdfA man has a condition where all of his gametes undergo nondisjunctio.pdf
A man has a condition where all of his gametes undergo nondisjunctio.pdf
 
____ The pigment produced by S. marvel scenes would appear first on t.pdf
____ The pigment produced by S. marvel scenes would appear first on t.pdf____ The pigment produced by S. marvel scenes would appear first on t.pdf
____ The pigment produced by S. marvel scenes would appear first on t.pdf
 
Write the advantages of using JavaFX with compare to Swing and AWT..pdf
Write the advantages of using JavaFX with compare to Swing and AWT..pdfWrite the advantages of using JavaFX with compare to Swing and AWT..pdf
Write the advantages of using JavaFX with compare to Swing and AWT..pdf
 
Write a program in c++ that produces a bar chart showing the populat.pdf
Write a program in c++ that produces a bar chart showing the populat.pdfWrite a program in c++ that produces a bar chart showing the populat.pdf
Write a program in c++ that produces a bar chart showing the populat.pdf
 
Write a 2 page essay describing what life was like in the Great Depr.pdf
Write a 2 page essay describing what life was like in the Great Depr.pdfWrite a 2 page essay describing what life was like in the Great Depr.pdf
Write a 2 page essay describing what life was like in the Great Depr.pdf
 
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdfWhy do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
Why do silver nanoparticles of 10 nanometers in diameter have lower m.pdf
 
Why Computer System Management is so critical for the companies (50.pdf
Why Computer System Management is so critical for the companies (50.pdfWhy Computer System Management is so critical for the companies (50.pdf
Why Computer System Management is so critical for the companies (50.pdf
 
Which of the following statements is not true about facilitated diff.pdf
Which of the following statements is not true about facilitated diff.pdfWhich of the following statements is not true about facilitated diff.pdf
Which of the following statements is not true about facilitated diff.pdf
 
Which is not a hypothesis for the origin of virusesThey originated .pdf
Which is not a hypothesis for the origin of virusesThey originated .pdfWhich is not a hypothesis for the origin of virusesThey originated .pdf
Which is not a hypothesis for the origin of virusesThey originated .pdf
 

Recently uploaded

The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 

Recently uploaded (20)

The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 

Using the provided table interface table.h and the sample linked lis.pdf

  • 1. Using the provided table interface table.h and the sample linked list code linkedList.c, complete an implementation of the Table ADT. Make sure that you apply the concepts of design by contract (DbC) to your implementation. Once you have fully implemented the table, create a main.c file that implements a testing framework for your table. Your table implementation must ensure that values inserted are unique, and internally sorted within a linked list. table.h linkedList.c Solution khsdg #include #include typedef enum BOOL { false, true } bool; // Linked list node definition typedef struct Node node; struct Node { int number; node *next; }; static node *top = NULL; // used to track where we are for the list traversal methods static node *traverseNode = NULL; // "destroy" will deallocate all nodes in a linked list object // and will set "top" to NULL. void destroy() { node *curr = top; node *temp = NULL; while ( curr != NULL ) {
  • 2. // flip order to see it blow up... temp = curr; curr = curr->next; free( temp ); } top = NULL; } // "build" will create an ordered linked list consisting // of the first "size" even integers. void build( int size ) { node *newNode = NULL; int i = 0; // make sure we don't have a list yet destroy(); for ( i=size ; i>0 ; i-- ) { newNode = malloc( sizeof( node ) ); newNode->number = i*2; newNode->next = top; top = newNode; } } // starts a list traversal by getting the data at top. // returns false if top == NULL. bool firstNode( int *item ) { bool result = false; if ( top ) { *item = top->number; traverseNode = top->next; result = true; } return result; }
  • 3. // gets the data at the current traversal node and increments the traversal. // returns false if we're at the end of the list. bool nextNode( int *item ) { bool result = false; if ( traverseNode ) { *item = traverseNode->number; traverseNode = traverseNode->next; result = true; } return result; } // "print" will output an object's entire linked list // to the standard output device -- one "number" per line. void print() { int value; if ( firstNode( &value ) ) { do { printf( "%d ", value ); } while ( nextNode( &value ) ); } } int main( int argc, char *argv[] ) { build( 10 ); print(); destroy(); build( 5 ); build( 20 ); print(); destroy(); return 0;
  • 4. }