DarkT 15 Newbie Poster

@ddanbe is right. Look at the last step of the cycle - j=9 is still less than 10 so it executes but you try to swap number[9] with number[10] which is out of range. Also I would do for(int j=0; j<9-i2; j++) - the biggest number always gets to the end so you need to check 1 less number in the next step. It's easiest to imagine with the biggest number initially being in the first place - the check is true in every step of the 1st iteration and it always gets swapped. It ends up at the last place and you don't need to check it in the 2nd iteration (and so on).

ddanbe commented: Good explanation. +15
DarkT 15 Newbie Poster

Yes, that's the page I found. Well, if there's no other solution, I will have to try that, even if MS doesn't approve. It's highly unlikely that we will have more than 40GB on the system drive and that's just not enough. I think that's a pretty lame restriction but let's not get into that :) Anyway, thank you, I will give the SymLinks a try. I'll leave the topic unsolved in case anyone has an idea but I highly doubt that.

DarkT 15 Newbie Poster

Hi everyone.
I have a very simple question to which apparently there is no easy solution (I googled a bit but haven't found any yet). How can I force Visul Studio 2013 to install on a different drive so that it doesn't eat up my C: space? In our company we are using virtual PCs for development which are provided by a 3rd party. Those machines are provided as standard packages and it's not possible to modify them. The C: drive comes with 40GB and there's nothing we can do to extend it. We want to upgrade from VS2005 to 2013 but after installation there's only 1GB free and we are bombed with "not enough space" tickets. I found a page that suggests creating a link. Idk if that's a very clean solution and if anyone knows about a better one I would be very thankful. If I don't find any, I guess I'll try the link.

DarkT 15 Newbie Poster

Hi everyone. I'm used to programming in C/C++ and I've created some dialog based windows apps. Recently, I've got an assignment at work to learn C# + WPF and its capabilities showing video. My company works with cameras and my job is to create an app to show their feed. Learning C# was fairly easy as many people say C# is easier than C++ but I struggle with WPF. A LOT.

For starters, I have a 10 second HD video converted to bitmaps frame by frame and I'm supposed to show them. I should test the performance when adding more videos (multiple cameras) and then look for other possibilities. The company used DirectShow before but it no longer meets the requirements as I was told (mainly user experience, videos flicker when resizing window and so on). I'm used to programming in loops and procedures and this event handling thing is a whole new approach for me and so far I don't like it (although it's great for creating beautiful GUI). I hate it when I don't understand the flow of an app (and I don't at the moment).. I just tried creating a simple project with one image control and after clicking a button, an infinite loop is supposed to cycle through 10 images displaying them in 0.5sec intervals. Actually, I want it to start immediately but I don't know where to put the loop (I mentioned my problem with understanding WPF app flow) so that's why I tried a …

DarkT 15 Newbie Poster

Ok, nevermind. I decided to use the longer but easier way :D Since I have the files I'll just format the partition and copy them back... It's 300GB so it'll take a long time but I'm really not in the mood of trying something better... Anyway, feel free to reply. It's better to have the knowledge in case something like this happens again :) I'll mark this as solved...

DarkT 15 Newbie Poster

Hi everyone. I'd like to ak for your help with a messed up partition (probably corrupted table as I understand it). I don't have much experience when it comes to this. Here's my problem: I have a probably corrupted disk and I wanted to create a partition avoiding the bad sectors. I had no idea which app would be suitable so I used a partition magic 8 (it came to my mind first as I used it in the past). I stared it up and it showed some message about fixing my partitions automatically and I was in a hurry so I just clicked ok (silly me, I'll never do that again, it's as our professor used to say - pc administrator should always read every message and warning...). Later when I came home I rebooted and found out that D: is missing. I'm using Windows 7 x64. Disk manager can see the partition but that's it. It shows it as a primary partition but there's no other info as there used to (NTFS, Healthy etc.), just the ammount of space. I booted up ubuntu and was able to backup my files but gparted showed no partitions on my disk at all (weird as I copied files...). I then tried diskpart, it sees the partition but no additional volume that I could assign a letter to.. Oh and when I try to change the letter in disk manager, it shows an error: "Disk Managment console view is not up-to-date." The …

DarkT 15 Newbie Poster

Hi there. I'm taking a test from big O this Friday so I was going through your thread. First of all, thanks Narue, the problem is now much clearer and I get all of the examples that Ajantis had (my problem was the way I was looking at the problem, e.g. bubble sort - n^2 seemed wrong to me, because the actual number of comparisons is n*(n-1) but that's something completely different I guess). There's just that b) Ajantis mentioned. You never said the actual complexity. What I mean is that, well, O(# of powers of 2 below n) isn't really an answer you'd give to a teacher, is it :) Isn't it just log n (base 2)? At least that's how I understand it and it's another way of saying # of powers of 2 below n after all (and sry if it's a dumb question, it's after after midnight here already :icon_lol:).. Again, thanks for the explanation, went through your tutorial too :)

DarkT 15 Newbie Poster

Thanks a lot gashtio. I fixed the problem. There was another one (I wan't initializing next pointers when adding new node to the list that was an easy one to find and solve). Long explanation was really helpful because I like to know how things work. Now that I think about it the error is really obvious.

DarkT 15 Newbie Poster

Hi everyone.
We were given a homework to code a hash table. The objects and their members were given by our professor and we were only supposed to implement the functions (Add, Remove, Contains and Print), so I shouldn't change the objects. I should also do a copy constructor and a assignment operator (but that's another story i don't think I'll have any problems with that after I solve my current problem). The code compiles just fine but at first I got a segmentation fault on the line 158:
HashTable[HashCode(key)].Add(key). In debug mode HashCode(key) = 5 which is OK (5%10 = 5) so I tried to print every element of the array in the constructor itself. HashTable[0] works fine but HashTable[1] gives the segmentation fault so I guess the allocation fails or there's a logical error as I'm pretty new to OOP (although I thought that I pretty much get it).
I'd be thankful for any help.

#include <iostream>
#include <new>

using namespace std;
       
class Set
{
    public: 
        typedef string T;           
        virtual void Add(const T& key) = 0;
        virtual bool Contains(const T& key) = 0;
        virtual void Print() = 0;
        virtual void Remove(const T& key) = 0;
};

class ListSet: public Set
{
    private:  
        struct Node
        {
            T value;
            Node* next;
        };
    
        Node* first;
    public:
        ListSet()
        {
            first = NULL;
        };  
        ~ListSet()
        {
            Node* next = NULL;
            
            while (first != NULL)
            {
                next = first->next;  
                delete first;
                first = next;
            }
        };  
        void Add(const T& key) …