Skip to content

Algorithm-archive/Learn-Data_Structure-Algorithm-by-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn Data Structure and Algorithms by C

You need to have basic understanding of the C programming language to proceed with the codes from this repository.

Table of Contents

  • Introduction to C

  • Data Structure

  • Searching

  • Sorting

  • Graph Algorithms

    • Graph Representation
    • Breadth First Search (BFS)
    • Depth First Search (DFS)
    • Topological Sort
    • Strongly Connected Components (SCC)
    • Minimum Spanning Tree (MST)
    • All Pairs Shortest Path (Floyd Warshall's Algorithm)
    • Single Source Shortest Path Algorithm
      • Djkastra's Algorithm
      • Bellman Ford Algorithm
    • Directed Acyclic Graph
    • Bipartite Matching
    • Articulation Point, Bridge
    • Euler Tour/Path
    • Hamiltonian Cycle
    • Stable Marriage Problem
    • Chinese Postman Problem
    • 2-satisfiability
    • Flow Algorithms
      • Maximum Flow
      • Minimum Cut
      • Min-Cost Max Flow
      • Maximum Bipartite Matching
      • Vertex Cover
  • Dynamic Programming

    • Rod Cutting
    • Maximum Sum (1D, 2D)
    • Coin Change
    • Longest Common Subsequence
    • Longest Increasing Subsequence
    • Matrix Multiplication
    • Edit Distance (Levenshtein distance)
    • 0/1 Knapsack
    • Travelling Salesman Problem
    • Optimal Binary Search Tree
  • Greedy Algorithms

    • Activity Selection/Task Scheduling
    • Huffman Coding
    • Knapsack Problem (Fractional Knapsack)
  • String Algorithms

    • Rabin-Karp Algorithm
    • Knuth-Morris-Pratt Algorithm
    • Z Algorithm
    • Aho-Korasick Algorithm
    • Manachers Algorithm
    • Boyr-Moore Algorithm
  • Number Theory

    • Greatest Common Divisor (GCD)
    • Longest Common Multiplier (LCM)
    • Euler Totient (Phi)
    • Prime finding(Sieve of Eratosthenes)
    • Prime factorization
    • Factorial
    • Fibonacci
    • Counting, Permutation, combination
    • Exponentiation
    • Big Mod
    • Euclid, Extended euclid
    • Josephus Problem
    • Farey Sequence
    • Catalan numbers
    • Burnside's lemma/circular permutation
    • Modular inverse
    • Probability
    • Chinese Remainder Theorem
    • Gaussian Elmination method
    • Dilworth's Theorem
    • Matrix Exponentiation
  • Computational Geometry

    • Pick's Theorem
    • Convex hull
    • Line Intersection
    • Point in a polygon
    • Area of a polygon
    • Line Sweeping
    • Polygon intersection
    • Closest Pair
  • Game Theory

    • Take Away Game
    • Nim's Game
    • Sprague-grundy Number
  • Others

    • BackTracking
      • N-Queen's Problem

Introduction

The type system in C is static and weakly typed. There are built-in types for integers of various sizes, both signed and unsigned, floating-point numbers, and enumerated types (enum). Integer type char is often used for single-byte characters. C99 added a boolean datatype (C99 added a builtin _Bool data type , and if you #include <stdbool.h>, it provides bool as a macro to _Bool.). There are also derived types including arrays, pointers, records (struct), and untagged unions (union).

Primitive types and built-in data structures in C

C is a statically typed language. Each of the variables should be type casted. There are five basic data types associated with variables:

  • int - integer: a whole number.
  • float - floating point value: i.e. a number with a fractional part.
  • double - a double-precision floating point value.
  • char - a single character.
  • void - valueless special purpose type.

Other than these there are some derived data types. they are -

  • Arrays
  • Pointers
  • Structures
  • Enumeration
More details about data types in C:

Big-O Notation and Time Complexity Analysis

Algorithms in plain English: time complexity and Big-O notation

Big-O Cheat Sheet Link

How to Use

To test or use codes from this repository you can use any popular IDE, online Editor or compile them locally using GCC compiler. Following links will help on how to compile a C code in linux.

TL;DR

Run following command to compile a C code (You need to have gcc compiler installed):

gcc file_name.c -o file_name

you will get an executable named: file-name

run it using:

./file_name

Useful Links:

About

Data Structure and Algorithm explanations with Implementations by C

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages