Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 62163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:25:58+00:00 2026-05-10T18:25:58+00:00

I’ve been looking (without great luck) for the perfect reference card with all the

  • 0

I’ve been looking (without great luck) for the perfect reference card with all the basic sorting algos in C (or maybe in pseudo code). Wikipedia is a terrific source of info but this time I’m looking for something definitely more portable (pocket size if possible) and of course printable. Any suggestion would be much appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:25:59+00:00Added an answer on May 10, 2026 at 6:25 pm

    I made this for a friend of mine studying C, maybe you will find it helpful:

    #include <stdlib.h> #include <string.h>  static void swap(int *a, int *b) {     if (a != b) {         int c = *a;         *a = *b;         *b = c;     } }  void bubblesort(int *a, int l) {     int i, j;      for (i = l - 2; i >= 0; i--)         for (j = i; j < l - 1 && a[j] > a[j + 1]; j++)             swap(a + j, a + j + 1); }  void selectionsort(int *a, int l) {     int i, j, k;     for (i = 0; i < l; i++) {         for (j = (k = i) + 1; j < l; j++)             if (a[j] < a[k])                 k = j;         swap(a + i, a + k);     } }  static void hsort_helper(int *a, int i, int l) {     int j;      for (j = 2 * i + 1; j < l; i = j, j = 2 * j + 1)         if (a[i] < a[j])             if (j + 1 < l && a[j] < a[j + 1])                 swap(a + i, a + ++j);             else                 swap(a + i, a + j);         else if (j + 1 < l && a[i] < a[j + 1])             swap(a + i, a + ++j);         else             break; }  void heapsort(int *a, int l) {     int i;      for (i = (l - 2) / 2; i >= 0; i--)         hsort_helper(a, i, l);      while (l-- > 0) {         swap(a, a + l);         hsort_helper(a, 0, l);     } }  static void msort_helper(int *a, int *b, int l) {     int i, j, k, m;      switch (l) {         case 1:             a[0] = b[0];         case 0:             return;     }      m = l / 2;     msort_helper(b, a, m);     msort_helper(b + m, a + m, l - m);     for (i = 0, j = 0, k = m; i < l; i++)         a[i] = b[j < m && !(k < l && b[j] > b[k]) ? j++ : k++]; }  void mergesort(int *a, int l) {     int *b;      if (l < 0)         return;      b = malloc(l * sizeof(int));     memcpy(b, a, l * sizeof(int));     msort_helper(a, b, l);     free(b); }  static int pivot(int *a, int l) {     int i, j;      for (i = j = 1; i < l; i++)         if (a[i] <= a[0])             swap(a + i, a + j++);      swap(a, a + j - 1);      return j; }  void quicksort(int *a, int l) {     int m;      if (l <= 1)         return;      m = pivot(a, l);     quicksort(a, m - 1);     quicksort(a + m, l - m); }  struct node {     int value;     struct node *left, *right; };  void btreesort(int *a, int l) {     int i;     struct node *root = NULL, **ptr;      for (i = 0; i < l; i++) {         for (ptr = &root; *ptr;)             ptr = a[i] < (*ptr)->value ? &(*ptr)->left : &(*ptr)->right;         *ptr = malloc(sizeof(struct node));         **ptr = (struct node){.value = a[i]};     }      for (i = 0; i < l; i++) {         struct node *node;         for (ptr = &root; (*ptr)->left; ptr = &(*ptr)->left);         a[i] = (*ptr)->value;         node = (*ptr)->right;         free(*ptr);         (*ptr) = node;     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 72k
  • Answers 72k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer If you are using any configuration tools like autotools you… May 11, 2026 at 1:49 pm
  • added an answer Shared hosting is going to make this a difficult problem… May 11, 2026 at 1:49 pm
  • added an answer Here is a critical question and something to try: Does… May 11, 2026 at 1:49 pm

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.