CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

# Search:

Type: Posts; User: zio_mangrovia

Page 1 of 4 1

1. ## Thread: binary search tree

by zio_mangrovia
Replies
7
Views
509

### Re: binary search tree

Good idea, I'll try again to write code according to your suggestion.
Thanks
2. ## Thread: binary search tree

by zio_mangrovia
Replies
7
Views
509

### Re: binary search tree

final.push_back(tree->D);

This statement doesn't change algorithm complexity, right? It's O(1), right?
3. ## Thread: binary search tree

by zio_mangrovia
Replies
7
Views
509

### Re: binary search tree

you can't imagine how much you helped me to understand problem.
I thought to this procedure and it Works.... after 2 daysssss

struct node { // D is max dist. from node to leaf of same type...
4. ## Thread: binary search tree

by zio_mangrovia
Replies
7
Views
509

### Re: binary search tree

I don't find to think the way using recursion to keep track of node type to compare, for example, to every leaf (which are at several levels)
I think It's easy if I have to calculate this Properties...
5. ## Thread: binary search tree

by zio_mangrovia
Replies
7
Views
509

### binary search tree

I need help because I'm not able to write code for this exercise:

I have binary search tree where every node has label of integer type.
Node is said even (odd) type if its label is even (odd)....
6. ## Thread: pass <vector> to function

by zio_mangrovia
Replies
7
Views
584

### Re: pass to function

I noted It's possible to manage <vector> even in this way:

void printcode(volo* pp, int nn) {
for (int i=0; i<nn; ++i) {
cout << pp[i].codice << endl;
cout << pp[i].num << endl;...
7. ## Thread: pass <vector> to function

by zio_mangrovia
Replies
7
Views
584

### Re: pass to function

I don t understand what means here & symbol
8. ## Thread: pass <vector> to function

by zio_mangrovia
Replies
7
Views
584

### pass to function

I'm making tests about <vector> and I want to pass it to function to insert some values, e.g.

#include <iostream>
#include <vector>
#include <cstring>
using namespace std;

struct volo {...
9. ## Thread: implementation of binary search tree by class

by zio_mangrovia
Replies
3
Views
328

### Re: implementation of binary search tree by class

In solution A, It's right to define "insert" function in private section of class? Could I define it into public section? What advantages could I get?
10. ## Thread: sort vector of struct: segmentation fault

by zio_mangrovia
Replies
4
Views
324

Thanks.
11. ## Thread: implementation of binary search tree by class

by zio_mangrovia
Replies
3
Views
328

### Re: implementation of binary search tree by class

I tested both ones and work but I'd like to know if It exists reason to choose one of them, I don't say about efficiency but just for RIGHT implementation choice.
12. ## Thread: sort vector of struct: segmentation fault

by zio_mangrovia
Replies
4
Views
324

### Re: sort vector of struct: segmentation fault

I wrong.

I wrong again.

You are right both points.
13. ## Thread: implementation of binary search tree by class

by zio_mangrovia
Replies
3
Views
328

### implementation of binary search tree by class

I want to create a binary search tree by class so I thought to this one:

struct node {
int info;
node *left, *right;

node(int info):
left(NULL),
14. ## Thread: sort vector of struct: segmentation fault

by zio_mangrovia
Replies
4
Views
324

### sort vector of struct: segmentation fault

I want to sort vector which is composed by struct elements, but I don't understand because sort function gives segmentation fault. Where I'm making mistakes?

#include <iostream>
#include...

by zio_mangrovia
Replies
8
Views
520

### Re: STL list

I tried with ddd but It often gives errors so I have to restart it again, so I decide to install new Debian machine to make exercises.
I found out if I leave STL library and I use this code:

...

by zio_mangrovia
Replies
8
Views
520

### Re: STL list

Thank you very much, It's best practise to initialise each list to NULL or It's automatically process in STL list library ?

by zio_mangrovia
Replies
8
Views
520

### Re: STL list

Excuse me for my stupid question but I'm teaching myself C++ language in environment by old customized Debian Virtual Machine with g++ version 4.7, which is provided by italian university

by zio_mangrovia
Replies
8
Views
520

### STL list

struct dati {
int id;
string cognome;
};

struct elem {
int cc;
list <dati> conto;
};

by zio_mangrovia
Replies
3
Views
379

### Re: tree level

I saw multiple versions and I would like to be sure It's right one.

by zio_mangrovia
Replies
3
Views
379

### tree level

Can you confirm this code is right to calculate level of binary tree (tree depth) ?

// albero vuoto = -1
// livello albero min. = 0
int tree_depth(Node* tree) {
if (!tree) return -1;
...
21. ## Thread: struct to vector

by zio_mangrovia
Replies
14
Views
937

### Re: struct to vector

vector<point> pp{temp}
It uses the copy constructor ?
22. ## Thread: struct to vector

by zio_mangrovia
Replies
14
Views
937

### Re: struct to vector

What means move semantics?
23. ## Thread: struct to vector

by zio_mangrovia
Replies
14
Views
937

### Re: struct to vector

here, I made a mistake to type "pushback".

I don't remember, this statement defines pp as vector of 'point' struct elements and it uses copy constructor to copy temp to vector element?
24. ## Thread: struct to vector

by zio_mangrovia
Replies
14
Views
937

### Re: struct to vector

Yes; I did but I was interesting to method to make it and if It exists another way, like initialization lists which I don't remember.
25. ## Thread: struct to vector

by zio_mangrovia
Replies
14
Views
937

### struct to vector

I have to allocate vector with several elements of 'point' type, where its values are collected by cin command.

I have this structure:

struct point {
int x;
int y;
};
Results 1 to 25 of 92
Page 1 of 4 1