Data Strucure in C
CtrlK
  • Week01 Memory Allocation Notes
    • Vector and Set Implementation
  • Week01 Lab Notes
    • Object Oriented C Programming
  • Week02 List Notes
    • How Deque is Implemented in C++:
    • Circular Doubly Linked List using Sentinel
  • Week02 Lab Notes
    • Are You Going to Write A Script Interpreter for the Language Design Module ?
  • Week03 Tree Notes
  • Week03 Lab Notes
  • Week 04 Graph Notes
  • Week04 Lab Notes
  • Week 05 Graph Notes
  • Week05 Lab Notes
  • Week06 Hashing Notes
  • Week06 Lab Notes
  • Week07 Notes
  • Week07 Lab Notes
    • Week07 Complexity Analysis
  • Week09 notes
  • Week09 Lab Notes
    • Import bookshop database with pqAdmin
    • psql console
  • Week 10 Lab Notes
Powered by GitBook
On this page
  • Use a circular buffer for a Vector ?
  • More efficient implementation of Set ?
  1. Week01 Memory Allocation Notes

Vector and Set Implementation

Use a circular buffer for a Vector ?

Java's ArrayList uses a circular buffer implementation

More efficient implementation of Set ?

Code from our lab assignments

bool contains(Set* st, int val)
{
    for (int i = 0; i < st->size; i++)
    {
        if (st->data[i] == val)
        {
            return true;
        }
    }
    return false;
}

Ordered Set : Balanced TreeSet

Unordered Set: Hash Table

Further Reading

LogoIntroduction to Set – Data Structure and Algorithm Tutorials - GeeksforGeeksGeeksforGeeks
PreviousWeek01 Memory Allocation NotesNextWeek01 Lab Notes

Last updated 6 months ago