View stack.js
const stack = (() => {
let arr = [],
index = -1;
const obj = {
push(val) {return arr[index += 1] = val},
pop() {
const val = arr[index];
arr[index] = undefined;
if (index >= 0) index -= 1;
View activity-selection-problem.c
/**
Activity Selection Problem
https://en.wikipedia.org/wiki/Activity_selection_problem
*/
#include <stdio.h>
#define FIN "activity2.in"
#define FOUT "activity.out"
#define SIZE 100
View create_add_delete_heap.c
#include <stdio.h>
#define size 100
int arr[] = {0,1,82,70,3,5,94,23,2,11},
n;
void create_heap() {
int i, j;
View heap_sort.c
#include <stdio.h>
#define size 100
#define FIN "algsort.in"
#define FOUT "algsort.out"
#define SIZE 500005
int arr[SIZE],
n;
View surjective.out
Generating All The Surjective Functions:
Domain -> card(A)
{1 2 3 }
CoDomain -> card(B)
{1 2 }
x | 1 2 3
---------------
f(x) | 1 1 2
View surjective.c
#include <stdio.h>
#define SIZE 100
int stack[ SIZE ],
level,
n,
m;
int init() {
View injective.out
Generating All The Injective Functions
f : A -> B
A = {1 2 }
B = {1 2 3 }
x | 1 2
----------------
View injective.c
#include <stdio.h>
#define SIZE 100
int stack[SIZE],
level,
n,
k;
void init(){
View Good-String.c
#include <stdio.h>
int main() {
int t;
scanf("%d",&t);
while(t--)
{
char a, b, c;
char S[50];
scanf("%s",S);
char *ptr=S;
View surjective.c
#include <stdio.h>
#define SIZE 100
int stack[SIZE],
level,
N,
M;
void init() {