Skip to content

Aurametrix/Alg-C

Repository files navigation

Algorithms in C/C++

=====

gcc mycode.c

c++ mycode.c++

gcc mycode.cpp -lstdc++

If c++ file does not have the main function (declared in another file), instead of:

c++ mycode.cpp

Try:

g++ -c mycode.cpp
g++ -c codethathasmain.cpp

Link with

g++ -omy_program codethathasmain.o mycode.o

C#

Unlike C++, there are no object (.obj) files created as a result of invoking the C# compiler Output files are created directly, so the C# compiler does not need a linker.

csc File.cs (=> File.exe) csc /out:MyFile.exe File.cs (=> MyFile.exe)

to create dll (dynamically linked library): csc /target:library File.cs

Language used in unity

===

=== Creating dynamically sized arrays at run-time is done using std::vector

//sizeof(i) returns the amount of memory (in bytes) for the variable or type i //sizeof an array is the distance between elements of that array

Standard C++ Library reference

Castor - C++ library to code a la Matlab

Libraries for server applications from MEta/FB

building a website with C++

[c++ web toolkit](https://www.webtoolkit.eu/wt/)

[A little Web Server in C](https://github.com/robdelacruz/lkwebserver)
  • Essential C (http://cslibrary.stanford.edu/101/) Explains the basic features of the C programming language.
  • Pointers and Memory (http://cslibrary.stanford.edu/102/) Explains how pointers and memory work in C and other languages. Starts with the very basics, and extends through advanced topics such as reference parameters and heap management.

(Hunting a memory leak](https://medium.com/zendesk-engineering/hunting-down-a-c-memory-leak-in-a-go-program-2d08b24b617d )

unrecognized command line option "-std=gnu++0x" GCC 4.2 is ancient, but Apple don't ship a newer version.

You can either install a modern GCC from somewhere like Mac Ports (which is probably simpler and quicker) or build it yourself following the instructions at http://gcc.gnu.org/wiki/InstallingGCC brew tap homebrew/versions && brew install gcc48

Basic Data Structures:

  1. STACKS Hashing for strings

  2. QUEUES

  3. LINKED LISTS

  4. BINARY TREES

Lock-free data structures

Representing Heterogenous Data

Structures in C: From Basics to Memory Alignment


Sort Worst Case Average Case Best Caase
Bogo O((n+1)!) O((n+1)!) O(n)
Bubble O(n2) O(n2) O(n)
Cocktail Shaker O(n2) O(n2) O(n)
Selection O(n2) O(n2) O(n2)
Gnome O(n2) O(n2) O(n2)
Comb O(n2) O(nlogn) O(nlogn)
Insertion O(n2) O(n2) O(n)
Shell O(n(log(n))2) O(n(log(n))2) O(nlogn)
Merge Sort O(nlogn) O(nlogn) O(nlogn)
Quick Sort O(n2) O(nlogn) O(nlogn)
Heap Sort O(nlogn) O(nlogn) O(nlogn)

What not to do:

+use malloc to dynamically allocate memory, and free to deallocate it. +malloc takes a count of bytes and returns a void pointer

+coding guidelines

Best ways to learn modern C
misc / interesting

Open source physics simulator for robotics + C API + https://deepmind.com/blog/announcements/mujoco

Swift

rem - remember everything calling Haskell from Swift

Embedded Swift for Raspberry Pi AttributeGrap, used internally by SwiftUI

Raspberry Pi

https://github.com/hoglet67/RGBtoHDMI https://stardot.org.uk/forums/viewtopic.php?f=3&t=14430 https://joetruncale.medium.com/thermos-d089e1c4974b https://github.com/gerrito333/mousehunter-edge/blob/master/README.md https://www.skyatnightmagazine.com/advice/diy/raspberry-pi-meteor-detector/ https://magpi.raspberrypi.org/articles/build-a-magic-mirror https://tinypilotkvm.com

You can't buy a Raspberry Pi right now - Oct 3, 2022 Cray vs Raspberry Pi

About

Algorithms in C and C++, some C#

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published