Hackerrank solutions.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 lines
530 B

#ifndef SEGTREE_H
#define SEGTREE_H
/*
* Simple integer segment tree implementation
* Author: Titouan Rigoudy
*/
struct segtree {
int i;
int j;
long v;
struct segtree *left;
struct segtree *right;
};
struct segtree *segtree_new(int i, int j, long v);
struct segtree *segtree_new_simple(int n);
void segtree_free(struct segtree *st);
void segtree_print(struct segtree *st);
void segtree_add(struct segtree *st, int i, int j, long v);
long segtree_get(struct segtree *st, int i);
#endif // SEGTREE_H