Git Product home page Git Product logo

libadt's Introduction

libadt

Codacy Badge

Structures

List

In computer science, a list or sequence is an abstract data type that represents a countable number of ordered values, where the same value may occur more than once. - Wikipedia

Implementation

Function Name Complexity Description
create_list O(1) Initialize list data structure
list_prepend O(1) Add an element to the front of the list
list_append O(1) Add an element to the end of the list
list_insert O(n) Insert an element after the given index
list_get O(n) Return the element at an index
list_find O(n) Return the index of the first occurrence of an item or -1 if unfound
list_replace O(n) Replace an element at an index
list_cut O(n) Remove the element at an index and return it's data
list_len O(1) Return the number of elements in the list if it is initialized and -1 otherwise
free_list O(n) Free all memory allocated to the data structure

Stack

In computer science, a stack is an abstract data type that serves as a collection of elements. The order in which elements come off a stack gives rise to its alternative name, LIFO (last in, first out). - Wikipedia

Implementation

Function Name Complexity Description
create_stack O(1) Initialize stack data structure
stack_push O(1) Add an element to the top of stack
stack_pop O(1) Remove and return the element at the top of the stack
stack_peek O(1) Return the element at the top of the stack
stack_empty O(1) Return 1 if the queue is empty and 0 otherwise
free_stack O(n) Free all memory allocated to the data structure

Queue

In computer science, a queue is a collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position, known as enqueue, and removal of entities from the front terminal position, known as dequeue. This makes the queue a First-In-First-Out (FIFO) data structure. - Wikipedia

Implementation

Function Name Complexity Description
create_queue O(1) Initialize queue data structure
enqueue O(1) Add an element to the end of queue
dequeue O(1) Remove and return the element at the front of the queue
queue_head O(1) Return the element at the front of the queue
queue_tail O(1) Return the element at the end of the queue
queue_empty O(1) Return 1 if the queue is empty and 0 otherwise
free_queue O(n) Free all memory allocated to the data structure

Multiset

In mathematics, a multiset (aka bag or mset) is a modification of the concept of a set that, unlike a set, allows for multiple instances for each of its elements. The positive integer number of instances, given for each element is called the multiplicity of this element in the multiset. - Wikipedia

Implementation

Function Name Complexity Description
create_mset O(1) Initialize multiset data structure
mset_add O(1) Add an element to the multiset
remove_element O(1) Remove all occurences of an element from the multiset
mset_union O(1) Returns a multiset that contains all elements of 2 multisets
mset_intersection O(1) Returns a multiset of all elements that are common between 2 multisets
mset_difference O(1) Returns the difference of two multisets
multiplicity O(n) Returns the number of occurences of an element
cardinality O(n) Return the number of distinct elements
mset_contains O(n) Return 1 if the set contains the element and 0 otherwise
equivalent O(n) Return 1 if 2 sets contain the same elements, each with the same multiplicity
free_mset O(n) Free all memory allocated to the data structure

libadt's People

Contributors

ajferron avatar

Stargazers

Shiro Creator avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.