https://github.com/akihiko47/c-experience
This repository contains my experiments with the C language. My goal is to create implementations of different data structures and algorithms.
https://github.com/akihiko47/c-experience
c data-structures
Last synced: 6 months ago
JSON representation
This repository contains my experiments with the C language. My goal is to create implementations of different data structures and algorithms.
- Host: GitHub
- URL: https://github.com/akihiko47/c-experience
- Owner: akihiko47
- Created: 2023-11-29T13:46:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-06T21:37:25.000Z (over 2 years ago)
- Last Synced: 2025-02-16T04:30:22.393Z (about 1 year ago)
- Topics: c, data-structures
- Language: C
- Homepage:
- Size: 655 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 📋 C experience 📋

This repository contains my C projects. I will try to implement different data structures and algorithms using this language.
## Albums file generator
File - `albumGenerator/main.c`
This project reads the albums you enter and writes them to the `albums.txt` file. This file has already been created, there you can see an example of how this program works. The album structures are stored in a dynamic array.
Folder of this project: `albumGenerator`
## Integers from string
Main file - `intsFromString/main.c`
Function file - `intsFromString/intfromstr.c`
Tests - `intsFromString/tests.c`
This program can pull a number from your string and convert it to int type. This project is an experiment with simple data types. Example of how the program works: `a12b34c5d` will be converted to `12345`. You can see tests in `tests.c`.
Function description: `int intfromstr(char * str);`
# Search algorithms 🔍
## Linear search
File - `Search/LinearSearch/linearsearch.c`
Tests - `Search/LinearSearch/tests.c`
Function description - `int linearsearch(int array[], int n, int x);` where array - array where you need to find element, n - number of elements in array, x - element that you need to find.
Function returns index of element `x` in array. If `x` not in array function will return -1
## Binary search

File - `Search/BinarySearch/binsearch.c`
Tests - `Search/BinarySearch/tests.c`
Function description - `int binsearch(int array[], int n, int x);` where array - array where you need to find element, n - number of elements in array, x - element that you need to find.
Function returns index of element x in array. If x not in array function will return -1. The array must be sorted!
## Naive string search

File - `Search/StringSearchNaive/strsearchnaive.c`
Tests - `Search/StringSearchNaive/tests.c`
Function description - `int strsearchnaive(char p[], char s[]);` where p (pattern) - part string that you want to find in s, s (string) - string where you want to find p.
The function returns the index of the first appearance of p in s. If there is no p in s, the function returns -1.
## Knuth–Morris–Pratt (KMP) string search algorithm

File - `Search/StringSearchKMP/strsearchkmp.c`
Tests - `Search/StringSearchKMP/tests.c`
Function description - `int strsearchkmp(char p[], char s[]);` where p (pattern) - part string that you want to find in s, s (string) - string where you want to find p.
The function returns the index of the first appearance of p in s. If there is no p in s, the function returns -1.
## Boyer–Moore (BM) string-search algorithm

File - `Search/StringSearchBM/strsearchbm.c`
Tests - `Search/StringSearchBM/tests.c`
Function description - `int strsearchbm(char p[], char s[]);` where p (pattern) - part string that you want to find in s, s (string) - string where you want to find p.
The function returns the index of the first appearance of p in s. If there is no p in s, the function returns -1.