Skip to content

Instantly share code, notes, and snippets.

View FeraruSilviuMarian's full-sized avatar

silviusilviu FeraruSilviuMarian

View GitHub Profile
;
; PROBLEM:
;
; Design a data definition to represent binary search trees. As a reminder,
; here is one example BST:
; an img of a binary search tree was here, because DrRacket allows images into the IDE, why
; .
(define-struct entry (key val))
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define BLOCK 512
int main(int argc, char *argv[])
{
// assure propper usage
if (argc != 2)
#include <stdio.h>
int main()
{
float x = 3.1;
float y = 3.1;
printf("%.20f\n", x); // 3.09999990463256835938
printf("%.20f\n", y); // 3.09999990463256835938
#include <stdio.h>
int main()
{
double x = 3.1;
float y = 3.1;
printf("%.20f\n", x); // 3.10000000000000008882
printf("%.20f\n", y); //3.09999990463256835938
import time
import random
def f(L):
"""
L: list
return list cu elemente cu frecventa impara
"""
t0 = time.clock()
def isSubstring(substring, string):
"""
substring: string
string: string
returns true if substring is substring of string e.g. 'cat' is substring of 'something cat something'
"""
si = 0 # substring indexer
for i in range(len(string)):
if string[i] == substring[si]:
si += 1 # notice, advancing the substring indexer each time we find a match
import time
import random
def f(L):
"""
L: list
return list cu elemente cu frecventa impara
"""
t0 = time.clock()
l = [1,1,2,3,3,2,1,2,3,3]
def f(L):
"""
L: list
return list cu elemente cu frecventa impara
"""
d = {}
for e in L:
d[e] = d.get(e, 0) + 1
l = [2,3,4,5,1,4,5,1,2]
def f(L):
d = {}
for e in L:
d[e] = d.get(e, 0) + 1
for key in d:
if d[key] % 2 != 0:
return key
@FeraruSilviuMarian
FeraruSilviuMarian / crack.c
Created September 22, 2017 15:14
generates plaintext combinations so far
#define _XOPEN_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>