分类
外汇操盘交易心得

Binary.com 经纪人审查和测试

人形魔芋 ​

Weekly Programming Challenge #1

I’ve been toying with an idea. This sort of thing is hardly new, so I don’t claim it as an original idea, but I can’t shake it, so I’m going to run with it.

Here it is: each week, I will post a new programming challenge. It might be to implement a data structure or algorithm. It might be to accomplish some task (like, find a solution to some puzzle or logistics problem).

It will always be something that requires you to write some software, and you will be challenged to complete it either as described (“normal”), or with some additional, specified constraints added (“hard”), or with some wacky, made-up constraints of your own that make the solution especially notable (“surprise me”).

You’ll have a week to produce your Binary.com 经纪人审查和测试 Binary.com 经纪人审查和测试 implementation. You’ll need to share it somewhere publicly accessible (I recommend a GitHub repository for these challenges). At the end of the week, all who participated will be listed, with the corresponding honors (“normal”, “hard”, or “surprise”). I may comment on those that I think especially deserve calling out, and then we’ll go around again with a new challenge.

No prizes. No judging. No competition. Just good, old-fashioned recreational programming in which we all might learn something new, and maybe have a chance to show off. :)

Are you on board? Great! Here goes…

Binary Search Trees!

A binary tree is a collection of nodes. Each node may have exactly zero, one, or two children. Every node has exactly one parent, except for the root node, which has no parent. Here’s a binary tree, where each node contains an integer:

A binary search tree is a binary tree where the nodes are ordered so that they may be searched very efficiently. When adding something to a binary search tree, you compare the new value to the root node. If it is less than the root node, you add it as the left-hand child. If it is greater (or equal), you add it to the right-hand child. If the node already has a left- or right-hand child, add the value to that child instead, proceeding recursively until you find a Binary.com 经纪人审查和测试 place to add the value.

To search the tree, then, you simply make the root node the “current” node, and then proceed recursively: compare the value you’re searching for with the current node. If it Binary.com 经纪人审查和测试 is less than the current node, search on the left-hand child. If it is greater, search on Binary.com 经纪人审查和测试 the right-hand node. If it is equal, well then, you’ve found what you’re looking for!

The Challenge

Normal Mode: Implement a binary search tree in the language of your choice. It should:

  1. Be configurable to support any kind of ordered data, though you may expect the data to be homogenous. (That is to say, you don’t have to compare strings and integers in the same tree, but your tree should support comparing both strings and integers, and any other ordered kind of data.)
  2. Support “insert” Binary.com 经纪人审查和测试 operations (adding values to the tree, in appropriate order.)
  3. Support “search” operations (finding a node with a specific value).
  4. Optionally support “delete” operations (removing a node from the tree). This is trickier than it sounds — but if you want a bit more challenge without going full-on hard mode, feel free to give this a try!

Hard Mode: The problem is that binary search trees can degenerate into simple linked lists, especially if given data that is already sorted. The root node points to just one child, which points to just one child, which points to just one child, all the way down to the one leaf of the tree. Searching this is not optimal — to find the value at the leaf, you wind up looking at every node of the tree! How do you get around that? Self-balancing binary search trees. There are several data structures that fall into this category, including AA trees, AVL trees, and Red-Black trees. For hard mode, implement one of these, with all the same requirements as normal mode, PLUS support for delete operations.

Suprise Me! Be creative. The sky’s the limit! As long as the result has something to do with binary search trees, it can be considered for this category, but it ought to be (1) software that you’ve written, and (2) at least as challenging as hard mode.

On your mark…get set…go!

This challenge is now ended, but please feel free to post your solutions anyway! I always love to see how people approach problems like this. To Binary.com 经纪人审查和测试 see the summary of this first programming challenge, read this post.

Video Viral Maba Unhas Non-Binary Diusir dari Kelas, Apa Itu Non-Biner?

Video Viral Maba Unhas Non-Binary Diusir dari Kelas, Apa Itu Non-Biner?

Apa itu non-biner? Non-biner merupakan gender yang mendefinisikan dirinya bukan Binary.com 经纪人审查和测试 sebagai perempuan maupun laki-laki

Suara.com - Perbincangan mengenai apa itu non-biner kembali mencuat. Hal tersebut bermula usai viral di media sosial video mahasiswa (maba) Unhas dikeluarkan dosen pada Jum'at (19/8/2022).

Diketahui, pada video viral Binary.com 经纪人审查和测试 tersebut terlihat seorang maba (mahasiswa baru) Fakultas Hukum Unhas (Universitas Hasanuddin) Makassar dikeluarkan dosen dari ruangan saat proses pengenalan kampus.

Mulanya, seorang mahasiswa baru yang mengenakan almamater serta kaca mata dipanggil agar maju ke depan. Kemudian, mahasiswa yang diketahui bernama NA tersebut ditanya oleh dosen mengenai status jenis kelaminnya. Secara mengejutkan NA menjawab bahwa statusnya adalah non-biner (non binary).

Jawaban NA sontak membuat sang dosen cukup tersulut emosinya. Dosen tersebut kemudian meminta panitia agar mengeluarkan NA dari ruangan.

Saat NA maju ke depan ditanya mengenai status kelaminnya, rupanya ada yang memvideokan. Video tersebut kemudian dijadikan konten oleh NA di media sosial dengan kata-kata yang kurang pantas.

Usai video tersebar dan viral di media sosial, banyak warganet yang bertanya-tanya dan mencari tahu mengenai apa itu non biner.

Jadi, sebenarnya apa itu non-biner? Untuk selengkapnya, perhatikan berikut ini pengetian non biner yang dirangkum dari berbagai sumber.

Apa Itu Non-Biner?

Non-biner merupakan gender yang mendefinisikan dirinya bukan sebagai perempuan maupun laki-laki. Hal tersebut tak jarang membingungkan banyak orang.

Secara biologis, manusia digolongkan kedalam dua kelompok, yaitui jantan dan betina. Akan tetapi, secara gender, muncul beberapa golongan baru dalam mendefinisikan dirinya sendiri.

Biasanya, gender non-biner ini memosiskan dirinya sendiri berbeda dengan struktur biologis bawaan lahir. Kelompok gender ini biasanya akan memosisikan dirinya bukan dari bagian kelompok gender yang telah ada, atau bahkan mempunyai gender yang lebih dari satu.

Lantas, Bagaimana Cara Menyapanya?

Jika umumnya seseorang dapat memosisikan dirinya sebagai perempuan atau laki-laki, itu artinya kata sapaan dalam bahasa Inggris yang digunakan yaitu She (perempuan) atau He (laki-laki). Namun saat seorang memosisikan dirinya sebagai non-biner, itu Binary.com 经纪人审查和测试 artinya kata sapaannya berubah, jadi They atau Them.

Sekedar informasi, gender non-biner ini juga memiliki sejumlah istilah lainnya. Adapun istilah-istilah tersebut yakni off the binary, genderfluid, agender, bigender, boi, butch, androgynus, dan gender neutral. Istilah-istilah tersebut memiliki definisinya masing-masing yang mungkin saja secara spesifik ada perbedaan pemahaman.

Demikian ulasan mengenai apa itu non-biner, yaitu sebuat istilah gender yang baru-baru ini tengah jadi perbingan hangat usai viralnya video mahasiswa baru Unhas menyatakan dirinya sebagai non-biner.

Hingga kini Suara.com masih mencoba mengonfirmasi pihak kampus mengenai video viral ini .Binary.com 经纪人审查和测试

二进制gcd(Binary gcd)

人形魔芋 ​

前置知识: \gcd (最大公约数),位运算

众所周知利用欧几里得算法(辗转相除法)可以做到在 \log 的时间复杂度内求出两个数的最大公约数

如果直接辗转相除硬求 \gcd 就会 T 得飞起,但是题解里那种方法 \Theta(值域) 预处理 \Theta(1) 查询又好麻烦,那么有没有一种更快的直接求两个数 \gcd 的方法呢?

二进制 \gcd 就是这样一种算法,它利用计算机优秀的二进制处理能力来计算 \gcd

假设现在我们需要求 \gcd(a,b) 满足 a,b>0

我们将 a,b 分为 5 种情况讨论

第一种, a=b 。显然 \gcd(a,b)=a=b

第二种, a=0 或 b=0 。根据最大公约数的定义当 b=0 时 \gcd(a,b)=\gcd(a,0)=a Binary.com 经纪人审查和测试 ,当 a=0 时 \gcd(a,b)=\gcd(b,0)=b

第三种, a,b 均为偶数。对于这种情况,显然 2 是公约数之一,直接将两个数都除以 2 ,再递归下去求 \gcd(\frac a2,\frac b2) 即可, \gcd(a,b)=2\cdot\gcd(\frac a2,\frac b2)

第四种, a,b 中有且仅有一个偶数。不妨设 a 是偶数,那么显然 2 不是公约数之一,直接将 a 除以 2 求 \gcd(\frac a2,b) 即可, \gcd(a,b)=\gcd(\frac a2,b)

第五种, a,b 均为奇数。不妨设 a>b ,那么有 \gcd(a,b)=\gcd(\frac2,b) ,为什么呢?下面来证明一下

设 a=k_1\gcd(a,b),\ b=k_2\gcd(a,b) 且 \gcd(k_1,k_2)=1 ,先考虑证明 \gcd(a-b,b)=\gcd(a,b) (即“更相减损术”)

a-b=(k_1-k_2)\gcd(a,b),\ b=k_2\gcd(a,b) ,那么有 \gcd(a-b,b)=\gcd(k_1-k_2,k_2)\cdot\gcd(a,b) ,即证 \gcd(k_1-k_2,k_2)=1

考虑反证法,假设 \gcd(k_1-k_2,k_2)=m 其中 m\in\mathbb,m>1 ,再设 k_1-k_2=t_1m,\ k_2=t_2m

就有 k_1=(t_1+t_2)m ,那么 \gcd(k_1,k_2)=m\cdot\gcd(t_1+t_2,t_2)>1 与 k_1,k_2 互质矛盾,得证 \gcd(k_1-k_2,k_2)=1

由于 a,b 均为奇数, a-b 就是偶数,那么问题就变成了和情况四一样, 2 显然不是公约数之一,故 \gcd(a,b)=\gcd(\frac2,b)

直接根据上图模拟,我们可以得到以下代码(注意: Binary.com 经纪人审查和测试 ~ 的运算优先级高于 | 和 & )

首先把两个数公约数中的所有 2 提出来,也就是把二进制末尾的 0 全部提出来,然后两个数就至少有一个是奇数,把两个数末尾的 0 再分别去掉就能保证一定是两个奇数,利用更相减损术循环求解就行,具体看代码

注意到每次还是都使用 while 来去除二进制下末尾的 0 ,效率低下,可以利用硬件函数 __builtin_ctz() 来继续加速

同时只有直接输入 0 时才可能 a=0 或是 b=0 ,所以如果输入保证不为 0 就可以去掉这个判断

这样我们就成功地利用 \Theta(\log n) 求 \gcd 切掉了 Luogu P5435 这道需要 Binary.com 经纪人审查和测试 \Theta(\text) 预处理 \Theta(1) 求 \gcd 的题目

Related News

Reviving Mexicos groundbreaking muralism movement a century later

Reviving Mexicos groundbreaking muralism movement a century later

France pays homage to beloved 'New Yorker' cartoonist Sempe

Flowered up: is it is too soon to beautify the wreckage of war?

A close-up of Joan of Arc on horseback in an illustration from a 1505 manuscript. Photo: Wikimedia Commons

A new Globe Theatre production exploring the life of Joan of Arc will see the legendary French heroine made into a non-binary character.

The historical figure is known for fearlessly leading the French in Binary.com 经纪人审查和测试 battles against English soldiers in the Hundred Years War, and is traditionally depicted as a woman.

Theatre bosses say the play, I, Joan, will "offer the possibility of another point of view” when it arrives later this month.

The lead role will be played by Isobel Thom, who also uses the pronouns "they/them” and the script has been altered to change the pronouns of the French patron saint.

"For centuries, Joan has been a cultural icon portrayed in countless plays, books, films, etc,” said Michelle Terry, artistic director of The Globe.

"History has provided countless and wonderful examples of Joan portrayed as a woman.

"This production is simply offering the possibility of another point of view.

"That Binary.com 经纪人审查和测试 is the role of theatre: to simply ask the question ‘imagine if?’”

She added: "Theatres produce plays, and in plays, anything can be possible.

"Shakespeare did not write historically accurate plays. He took figures of the past to ask questions about the world around him.

"Shakespeare was not afraid of discomfort, and neither is The Globe.”

A statement on The Globe’s website affirmed that it was "committed Binary.com 经纪人审查和测试 to becoming an inclusive and diverse organisation” willing to make "necessary change.”

"We aim to create a culture and environment in which everyone’s experience at Shakespeare’s Globe is equal, inclusive, and equitable,” it said.