<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>KNN using c++ for nRF51822, any suggestion for this output?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33411/knn-using-c-for-nrf51822-any-suggestion-for-this-output</link><description>Hello world. 
 After I have used this guy code.. KNN c++ . and good for implement it to my module nRF51822. 
 But if there&amp;#39;s problem issue or not. because, there was an confusing problem. that show like this one: 
 1. if I&amp;#39;m using this 
 
 there&amp;#39;s problem</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 15 Apr 2018 07:19:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33411/knn-using-c-for-nrf51822-any-suggestion-for-this-output" /><item><title>RE: KNN using c++ for nRF51822, any suggestion for this output?</title><link>https://devzone.nordicsemi.com/thread/128349?ContentTypeID=1</link><pubDate>Sun, 15 Apr 2018 07:19:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3831f65d-70f8-4fa5-975b-c351b162eb56</guid><dc:creator>mantap</dc:creator><description>&lt;p&gt;I have solve one of them.. using this function&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;dfn&gt;#include &amp;lt;algorithm&amp;gt;  &lt;/dfn&gt;&lt;/code&gt;and std::sort that can active the sorting function..&lt;/pre&gt;
&lt;hr /&gt;
&lt;pre&gt;here is the code..&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;mbed.h&amp;quot;
#include &amp;quot;Serial.h&amp;quot;
#include &amp;lt;algorithm&amp;gt;  
Serial uart1(USBTX,USBRX);
using namespace std;
...

nt classifyAPoint(Point arr[], int n, int k, Point p)
{
    for (int i = 0; i &amp;lt; n; i++)
        arr[i].distance =
            sqrt ((arr[i].x - p.x) * (arr[i].x - p.x) + 
                  (arr[i].y - p.y) * (arr[i].y - p.y));
                  
    std::sort (arr, arr+n, comparison);
    ...
}&lt;/pre&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>