scuan🇮🇱
scuan🇮🇱
CC#
Created by scuan🇮🇱 on 9/17/2024 in #help
did i code right?
Oh man.. was i supposed to post this in code review? @Buddy, Citizen of Pluto 🔱
21 replies
CC#
Created by scuan🇮🇱 on 9/17/2024 in #help
did i code right?
Also forgot to mention im using a package so everything with stack is the same but Top() is the same as pop but it doesnt remove only observes/retrieves
21 replies
CC#
Created by scuan🇮🇱 on 9/17/2024 in #help
did i code right?
Good ye?
21 replies
CC#
Created by scuan🇮🇱 on 9/17/2024 in #help
did i code right?
public static Stack<int> eigtheen(Stack<Couple> ss)
{
Stack<Couple> sscopy2 = Copy(ss);//for order
Stack<Couple> sscopy3 = Copy(ss);


Stack<int> Order = new Stack<int>();//set order
Stack<Couple> extra = new Stack<Couple>();//set order


int minum = sscopy2.Top().GetNum();//set minum
int g = 0;//min spot
bool b = true;
while (!sscopy3.IsEmpty())
{
minum = sscopy2.Top().GetNum();//get first
while (!sscopy2.IsEmpty())
{


minum = Math.Min(minum, sscopy2.Pop().GetNum());//find the min num currently
}
Order.Push(minum);//push to the bottom the min num;
while (b)
{
if (sscopy3.Top().GetNum() == minum)
{
sscopy3.Pop();//remove the min in order
b = false;
}
else
{
extra.Push(sscopy3.Pop());//save it
}
}

b = true;
while (!extra.IsEmpty())//refill
{
sscopy3.Push(extra.Pop());
}
sscopy2 = Copy(sscopy3);//again but with new numbers

}

Stack<int> final = new Stack<int>();//the final to return
b = true;//making sure
sscopy2 = Copy(ss);//reuse

while (!Order.IsEmpty())//clear all orders
{
while (!sscopy2.IsEmpty() && b)
{
if (Order.Top() == sscopy2.Top().GetNum())

b = false;


else

sscopy2.Pop();

}
for (int i = 0; i < sscopy2.Top().GetAppears(); i++)
{
final.Push(Order.Top());
}
Order.Pop();
sscopy2 = Copy(ss);//get ready for next time
b = true;
}
return final;
}
public static Stack<int> eigtheen(Stack<Couple> ss)
{
Stack<Couple> sscopy2 = Copy(ss);//for order
Stack<Couple> sscopy3 = Copy(ss);


Stack<int> Order = new Stack<int>();//set order
Stack<Couple> extra = new Stack<Couple>();//set order


int minum = sscopy2.Top().GetNum();//set minum
int g = 0;//min spot
bool b = true;
while (!sscopy3.IsEmpty())
{
minum = sscopy2.Top().GetNum();//get first
while (!sscopy2.IsEmpty())
{


minum = Math.Min(minum, sscopy2.Pop().GetNum());//find the min num currently
}
Order.Push(minum);//push to the bottom the min num;
while (b)
{
if (sscopy3.Top().GetNum() == minum)
{
sscopy3.Pop();//remove the min in order
b = false;
}
else
{
extra.Push(sscopy3.Pop());//save it
}
}

b = true;
while (!extra.IsEmpty())//refill
{
sscopy3.Push(extra.Pop());
}
sscopy2 = Copy(sscopy3);//again but with new numbers

}

Stack<int> final = new Stack<int>();//the final to return
b = true;//making sure
sscopy2 = Copy(ss);//reuse

while (!Order.IsEmpty())//clear all orders
{
while (!sscopy2.IsEmpty() && b)
{
if (Order.Top() == sscopy2.Top().GetNum())

b = false;


else

sscopy2.Pop();

}
for (int i = 0; i < sscopy2.Top().GetAppears(); i++)
{
final.Push(Order.Top());
}
Order.Pop();
sscopy2 = Copy(ss);//get ready for next time
b = true;
}
return final;
}
21 replies
CC#
Created by scuan🇮🇱 on 9/17/2024 in #help
did i code right?
Black screen
21 replies
CC#
Created by scuan🇮🇱 on 9/17/2024 in #help
did i code right?
Im on phone so its kind of hell to try that
21 replies
CC#
Created by scuan🇮🇱 on 9/17/2024 in #help
did i code right?
@Buddy, Citizen of Pluto 🔱 ok?
21 replies
CC#
Created by scuan🇮🇱 on 9/17/2024 in #help
did i code right?
.
21 replies
CC#
Created by scuan🇮🇱 on 9/17/2024 in #help
did i code right?
Also forgot to mention im using a package so everything with stack is the same but Top() is the same as pop but it doesnt remove only observes/retrieves
21 replies
CC#
Created by scuan🇮🇱 on 9/17/2024 in #help
did i code right?
Its because its given i have this class and dont need to create it and got a copy stack static i didnt create
21 replies