[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
ALGORITHMS
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 19
Thread images: 5
File: 12312312.png (623 KB, 1280x720) Image search: [Google]
12312312.png
623 KB, 1280x720
>Post an algorithm without revaling what it does
>We try to figure out what it is
>>
>>54870799
Dijkstra's algorithm?
>>
var foo = function(arr) {
for (var i = 0; i < arr.length; i++) {
var key = arr[i];
var j = i;
while (j >= 0 && arr[j - 1] < key) {
arr[j] = arr[j - 1];
j--;
}
arr[j] = key;
}
return arr;
}
>>
File: dw8.png (456 KB, 568x568) Image search: [Google]
dw8.png
456 KB, 568x568
collection.push(collection.splice(i, 1)[0]);
>>
>>54870877
Insertion sort that sorts values in an array from highest to lowest
>>
function kek = function(S, W) {
var m = 0;
var i = 0;
var T = foo(W);
while (m + i < S.length) {
if (W[i] == S[m + i]) {
if (i == W.length - 1) return m;
i++;
} else if (T[i] > -1) {
m = m + i - T[i];
i = T[i];
} else {
m = m + i + 1;
i = 0;
}
}
return S.length;
}
>>
File: cables.jpg (502 KB, 2048x1536) Image search: [Google]
cables.jpg
502 KB, 2048x1536
>>54870799
Hard mode.
Don't think any of you fags can reverse engineer this :)

AAA macro size:req
LOCAL startOfRegion, cloop, movEdxLabel, eaxJump
if USE_AAA
option epilogue:none ; We use a RET in the middle

; Part 1
push esi
pop eax
mov esi, edi
mov edi, eax
push $-6
push 0BBBBDDDDh
xor ecx,ecx
pop dx
movEdxLabel:
mov edx, size
xchg edi, esi
ret

; Part 2
mov eax, [esp-4]
push edi
push ebx
mov ebx, size/4
mov edx, 5A175A17h
xchg ecx,ebx
xchg esi,eax
push eax
mov edi, 0FAFAFAFAh
add esi, 66 ; Offset from esi to end of the macro
or ebx, ecx

cloop:
xor eax,eax
xor [esi+edx*4], edi
shl edi,1
add edi,edx
add edx, 0DDCCAABBh
xchg edx,eax
div ecx
mov eax,ebx
dec eax
jnz eaxJump

pop edi
pop ebx
pop esi
jmp short movEdxLabel+1
eaxJump:
xchg eax, ebx
mov eax, esi
sub eax, 36
jmp eax
startOfRegion:
option epilogue:EpilogueDef
endif
endm
>>
>>54870799
You guys will never find out what it does :^)
for (var i=1; i<=100; i++)    {
if (i % 3 === 0 && i % 5 === 0) {
console.log("FizzBuzz") }
else if (i % 3 === 0) {
console.log("Fizz") }
else if (i % 5 === 0) {
console.log("Buzz") }
else {
console.log(i) }
}
>>
>>54871111
Gets you through a technical interview in a web dev company.
What do I win?
>>
>>54871111
Nice meme
>>
>>54870799


SqlConnection thisConnection = new SqlConnection(@"Data Source=localhost;
Initial Catalog=default;
Persist Security Info=True;
User ID=user;
Password=B1GT1tti3z");
thisConnection.Open();

string Get_Data =
@"DECLARE @start INT = 1;
DECLARE @end INT = 100;

WITH numbers AS (
SELECT @start AS number
UNION ALL
SELECT number + 1
FROM numbers
WHERE number < @end
)
SELECT *
FROM numbers
WHERE number % 2 <> 0
OPTION (MAXRECURSION 0);";

SqlCommand cmd = thisConnection.CreateCommand();
cmd.CommandText = Get_Data;

SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
var ayy = dt.AsEnumerable().ToList();

foreach (var number in ayy)
{
WriteLine(number.ItemArray[0]);
}
>>
File: File0038.png (170 KB, 1893x1745) Image search: [Google]
File0038.png
170 KB, 1893x1745
>>
>>54871179
Reduce.
>>
>>54871179
That's an FFT butterfly diagram
>>
>>54871111
Holy fuck sticks quads
>>
>>54871111
Nice quads. Made a shell version because it looks to fucking simliar.

for ((i = 1 ; i <= 100 ; i++)) {
if [ $((i % 3)) = 0 ] && [ $((i % 5)) = 0 ]; then
printf 'FizzBuzz\n'
elif [ $((i % 3)) = 0 ]; then
printf 'Fizz\n'
elif [ $((i % 5)) = 0 ]; then
printf 'Buzz\n'
else
printf '%s\n' "$i"
fi
}
>>
>>54871304
correct
>>
>>54871111
Winner
>>
File: 1437419108754.png (199 KB, 413x374) Image search: [Google]
1437419108754.png
199 KB, 413x374
>>54870947
Serious love
Thread replies: 19
Thread images: 5

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.